Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method for automatic creation for Singleton mode in component programming

An automatic generation and component technology, applied in the direction of multi-programming devices, etc., can solve problems such as programming complexity, and achieve the effect of reducing programming complexity.

Inactive Publication Date: 2008-07-02
上海科泰华捷科技有限公司
View PDF0 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

It can be seen that different users and different languages ​​may implement the Singleton mode differently, but they must write the Singleton class themselves, so that users must spend energy to implement the singleton mode while implementing the functions of the class. code, which brings a certain degree of complexity to the user's programming

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for automatic creation for Singleton mode in component programming
  • Method for automatic creation for Singleton mode in component programming
  • Method for automatic creation for Singleton mode in component programming

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0041] The present invention will be described in further detail below in conjunction with the accompanying drawings.

[0042] According to the method provided by the present invention, in CAR component programming, the realization of the singleton mode is not to obtain the corresponding attributes by inheriting a singleton base class like the above-mentioned java or .Net, but directly declares it as a global variable and initializes it. Multi-thread synchronization management ensures that there is only one instance of this global variable.

[0043] When the user specifies a class in the .car file as the singleton attribute and compiles the .car file, the CAR compiler will automatically generate relevant processing codes, and the processing process is as follows: First, several related global variables will be declared, except for corresponding In addition to the global pointer of this object, there is also a state value representing the current state of this object, and a glo...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for automatically generating a Singleton mode in a component programming. The method includes the following steps: a whole object variable, a whole status value and a whole lock are defined; the status value is locked; the whole status value is detected and judged, when the whole status value is not initialized, the object is initialized, and the initializing of the whole status value is set correspondingly; when the whole status value is in initializing, that the object initializing is acted in the other route is indicated, now the route enters into a wait state, and the route status of distributing objects are continuously detected through the whole status value; when the whole status value is initialized, the value of the whole object variable is obtained; the whole status value which is unlocked returns to the object value. The invention declares the whole variable directly and acts the initialization, the multithreading synchronization management is executed at the same time, the relative Singleton mode realization code is automatically generated after the corresponding car file is compiled, and the complex degree of programming is lowered for a user.

Description

technical field [0001] The invention relates to a method for generating program codes, in particular to a method for automatically generating Singleton patterns in component programming. Background technique [0002] Since the 1980s, software programming technology has developed greatly, and its development can be roughly divided into the following stages: [0003] Object-oriented programming, that is, through the encapsulation of software modules, make them relatively independent, thus simplifying complex problems. Object-oriented programming emphasizes the encapsulation of objects, but the relationship between modules (objects) has been fixed at compile time, and the relationship between modules is static, and this relationship cannot be changed when the program is running; that is to say: Substitution of smaller functional units within a module is not possible at runtime. [0004] Component-oriented programming means that in order to make the component modules (software...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/46
Inventor 陈榕梁宇洲杨洋
Owner 上海科泰华捷科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products