CN1904825A - Constructive method for use in member initialization process - Google Patents

Constructive method for use in member initialization process Download PDF

Info

Publication number
CN1904825A
CN1904825A CNA200610029755XA CN200610029755A CN1904825A CN 1904825 A CN1904825 A CN 1904825A CN A200610029755X A CNA200610029755X A CN A200610029755XA CN 200610029755 A CN200610029755 A CN 200610029755A CN 1904825 A CN1904825 A CN 1904825A
Authority
CN
China
Prior art keywords
interface
component
class
service end
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA200610029755XA
Other languages
Chinese (zh)
Other versions
CN100462914C (en
Inventor
陈榕
梁宇洲
黄凯峰
文立
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
KETAI CENTURY SCIENCE AND TECHNOLOGY Co Ltd SHANGHAI
Original Assignee
KETAI CENTURY SCIENCE AND TECHNOLOGY Co Ltd SHANGHAI
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by KETAI CENTURY SCIENCE AND TECHNOLOGY Co Ltd SHANGHAI filed Critical KETAI CENTURY SCIENCE AND TECHNOLOGY Co Ltd SHANGHAI
Priority to CNB200610029755XA priority Critical patent/CN100462914C/en
Publication of CN1904825A publication Critical patent/CN1904825A/en
Application granted granted Critical
Publication of CN100462914C publication Critical patent/CN100462914C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a construction method in constructing initialization process. It includes the following steps: adding component interface unit data, special constructing function to component expression file; generating construction code frame according to special constructing function; generating construction calling method, component object species factory at client end according to component interface unit data; and acquiring corresponding construction interface species; calling corresponding construction interface method and return the operation result. The method could realize component remote constructing method and support distribution system. It improves developing efficiency and execution efficiency, lowers developing difficult, enhances stability, etc.

Description

Building method in the member initialization procedure
Technical field
The present invention relates to computer software technical field, particularly computer component software systems field specifically is meant the building method in a kind of member initialization procedure.
Background technology
Along with further developing of modern componentization computer software technology, CAR (Component Assembly Runtime) component technology is a kind of use component-oriented programming (Component Oriented Programming, be called for short COP) technology, it has defined the component programming model and the programming standard in cover network programming epoch, stipulated the standard called mutually between one group of member, make that the scale-of-two member can self-described, can dynamic link when operation.
At present, the CAR component technology realizes on some advanced embedded OS that under the SDK of this embedded OS (Software Development Kit), the user is easy to write out the member of oneself.
The basic thought source of CAR component technology is in the COM of Microsoft, but it expands the COM of Microsoft, and the two is incompatible.The CAR component technology is supported by CAR language (component description language, the metadata information of description member), CAR compiler, automatic code Core Generator and CAR member base library.The CAR component technology has embodied the characteristic in network programming epoch, and programming interface is simple.
The construction process of the similar common C++ object of CAR member structure mechanism, the C++ object is constructed the C++ object by the different constructed fuction of class under different situations, and different constructed fuctions shows different parameters.Simultaneously, for the structure mechanism of traditional C++ object, mainly contain two functions: one is to distribute the required space of object, another initialization member variable.The constructed fuction of C++ is common function, so it can not be carried out by long-range, and it does not have rreturn value, so during the structure failure, it is unusual difficult to wonder that the reason of failure can become, and for the member of the long-range structure of needs, the structure failure can be a common phenomena, and client need be understood the reason of failure, to make corresponding processing, and the construction process of traditional C++ and mechanism just can't satisfy such demand, have therefore limited further developing of the component technology in the distributed system.
Summary of the invention
The objective of the invention is to have overcome above-mentioned shortcoming of the prior art, provide a kind of can according to the component description file generate automatically member structure interface class code skeleton, support client and service end long-range make, will construct that the result returns, carries out that efficient is higher, runnability is reliable and stable, the scope of application building method in the member initialization procedure comparatively widely.
In order to realize above-mentioned purpose, the building method in the member initialization procedure of the present invention is as follows:
Building method in this member initialization procedure comprises the service end and the client that are connected by computer network, and its principal feature is that described method may further comprise the steps:
(1) system carries out initialization operation;
(2) system operates according to the user, adds component interface descriptor and specific constructed fuction in the component description file;
(3) system reads this component description file, produces metadata, and comprises the structure interface class code skeleton of constructing interface method according to this specific constructed fuction in the service end generation;
(4) system obtains metadata, and generates the structure call method according to this metadata in client;
(5) system is called and metadata information according to the user, produces member class factory object in client;
(6) system is in the corresponding structure of service end inquiry interface class;
(7) corresponding structure interface method calls according to the structure interface class that inquires in system, and operating result is returned as rreturn value, thereby finishes the initialization structure of member.
The form of the specific constructed fuction of the building method in this member initialization procedure is: constructed fuction sign ([input] input parameter).
The constructed fuction of the building method in this member initialization procedure is designated constructor.
Generating in service end of building method in this member initialization procedure comprises that the structure interface class code skeleton of constructing interface method may further comprise the steps:
(1) generates the code of constructing interface class in service end;
(2) generate the structure interface method of this structure interface class according to described specific constructed fuction, the form of this structure interface method is: error code interface method sign (input parameter, the member pointer), wherein error code is the rreturn value of this structure interface method;
(3) in the implementation of this structure interface method, produce this member and carry out initialized operation, and member produced and the error code of initialization operation is returned as rreturn value.
May further comprise the steps of building method in this member initialization procedure at client generation structure call method:
(1) in client according to the component interface metadata, produce specific constructed fuction and component interface structure call method, the form of this structure call method is: error code building method sign (input parameter, member pointer), and wherein error code is the rreturn value of this structure call method;
(2) in the implementation of this structure call method, produce member class factory object, in the corresponding structure of service end inquiry interface class, call corresponding structure interface method according to this structure interface class and produce the operation that member and initialization are constructed to finish, and the error code of aforesaid operations is returned as rreturn value.
The building method of the building method in this member initialization procedure is designated New.
Adopted the building method in the member initialization procedure of this invention, because system comprises the structure interface class code skeleton of constructing interface method according to component interface metadata in the component description file and specific constructed fuction information in the service end generation in initialization procedure, automatically generate corresponding structure call method in client simultaneously, and the result that will operate returns to the user as rreturn value, thereby the long-range make of the member of reliably having realized client and service end, and can support distributed system to use preferably; To construct the result simultaneously and return the user, being convenient to the user handles targetedly, thereby developer's development efficiency and executing efficiency have been improved, reduced development difficulty, strengthened the stability of program run performance, the scope of application is comparatively extensive, for further developing of distributed element software systems established solid foundation.
Description of drawings
Fig. 1 is the implementation synoptic diagram of the building method in the member initialization procedure of the present invention.
Fig. 2 is the internal storage structure synoptic diagram in the implementation of the building method in the member initialization procedure of the present invention.
Fig. 3 is that the interface inheritance of the building method in the member initialization procedure of the present invention concerns synoptic diagram.
Embodiment
In order more to be expressly understood technology contents of the present invention, describe in detail especially exemplified by following examples.
See also shown in Figure 1ly, the building method in this member initialization procedure comprises the service end and the client that are connected by computer network, and wherein, described method may further comprise the steps:
(1) system carries out initialization operation;
(2) system operates according to the user, in the component description file, add component interface descriptor and specific constructed fuction, the form of the constructed fuction that this is specific is: constructed fuction sign ([input] input parameter), wherein this constructed fuction sign can be constructor, can certainly adopt other identification strings according to programming development personnel's custom;
(3) system reads this component description file, produces metadata, and comprises the structure interface class code skeleton of constructing interface method according to this specific constructed fuction in the service end generation, may further comprise the steps:
(a) generate the code of constructing interface class in service end;
(b) generate the structure interface method of this structure interface class according to described specific constructed fuction, the form of this structure interface method is: error code interface method sign (input parameter, the member pointer), wherein error code is the rreturn value of this structure interface method;
(c) in the implementation of this structure interface method, produce this member and carry out initialized operation, and member produced and the error code of initialization operation is returned as rreturn value;
(4) system obtains metadata, and generates the structure call method according to this metadata in client, may further comprise the steps:
(a) in client according to the component interface metadata, produce specific constructed fuction and component interface structure call method, the form of this structure call method is: error code building method sign (input parameter, the member pointer), wherein error code is the rreturn value of this structure call method, wherein this building method sign can be New, can certainly adopt other identification strings according to programming development personnel's custom;
(b) in the implementation of this structure call method, produce member class factory object, in the corresponding structure of service end inquiry interface class, call corresponding structure interface method according to this structure interface class and produce the operation that member and initialization are constructed to finish, and the error code of aforesaid operations is returned as rreturn value;
(5) system is called and metadata information according to the user, produces member class factory object in client;
(6) system is in the corresponding structure of service end inquiry interface class;
(7) corresponding structure interface method calls according to the structure interface class that inquires in system, and operating result is returned as rreturn value, thereby finishes the initialization structure of member.
In the middle of practical application, the CAR member that adopts said method of the present invention has following characteristics in the process of constructing:
(1) long-range structural property
Long-range is the ability of CAR component interface, and the structure of CAR member then is an interface method.So just allow to construct certain CAR member from long-range band parameter.
The local building method of member, for example at the graphical control button object of placement configurations of (100,110):
Position?pos={100,110};
IButtonSam*pbs=NULL;
ECODE?ec=CButtonSam.New(&pos,&pbs);
if(FAILED(ec)){
printf("Failed?to?create?object?with?using?Positon,\
ec=0x%08x\n",ec);
goto?ErrorExit;
}
Long-range (referring to different process) building method of member, such as:
ec=CButtonSam.NewInContext(CTX_DIFF_DOMAIN,&pos,&pbs);
Tell system that service-creation is referred to different process, the establishment of the similar com of Microsoft object, other process does not have big difference.
(2) characteristic of returned value of the structure of CAR member
Illustrate with top example.Return ec during structure, it is the error code of system definition, by analyzing its value, just can know what mistake has taken place when constructing again, and then make the processing of response.
At this moment the service interface of component object is spread out of by last parameter band of New function, and traditional C++ constructed fuction also can not be taken the structure result out of by parameter.
(3) the automatic formation characteristic of skeleton code
At first be that the service end code generates automatically:
The CAR member provides maximum convenience to the programmer, only need in component description file (car file), add special constructed fuction constructor (), system just can generate the structure interface automatically, as _ CButtonSam_IClassObject_, it has and the corresponding interface method of constructing variable, such as: CreateObjectWithPos (/ * [in] */PPosition pos ,/* [out] */IObject**ppNewObj).Therefrom as can be seen, its function name and programmer structure during object with constructing variable be closely related, the method can go out component object according to the parametric configuration that the user passes into.Because interface _ CButtonSam_IClassObject_ is sightless to the user, so according to car file generating code, the user only need realize that GetPosition () and constuctor () function are just passable to its interface CreateObjectWithPos () by system.
The literary style of component description file (Car file), ask for an interview as follows:
Module { typedef struct{ int x; Inty; Position, * PPosition; Other interface interface IButtonSam{ GetPosition ([out] PPosition pPos) that // service end is supported; Class CButtonSam{ constructor ([in] PPosition pos); Other interface interface IButtonSam that // service end is supported;
Then be that client code generates automatically:
According to the component interface metadata, system is client generation method ECODE New (/ * [in] */PPosition pos, / * [out] */IButtonSam**pIButtonSam), this method is called traditional EzGetClassObject method earlier and is produced component object class factory, inquire the structure interface again as _ CButtonSam_IClassObject_, call corresponding structure interface method according to the difference of parameter again, as: CreateObjectWithPos etc.Its execution flow process sees also shown in Figure 1, and wherein center section is the code that is generated by system, and Far Left partly is the code that the client user is concerned about, rightmost is the code that the service end user is concerned about.
In the implementation procedure of the structure mechanism of CAR member, for the long-range construction ability that CAR member DLL can be possessed, just need the design interface function to help member to finish initialization, internal storage structure when the CAR member DLL that structure is good carries out sees also shown in Figure 2, V1 wherein points to the function pointer table of IButtonSam, V2 points to the function pointer table of interface _ CButtonSam_IClassObject_, and V1 and V2 pointer are equal to the vptr among the com, are the virtual table pointers.
The inheritance of its interface sees also shown in Figure 3, and CButtonSam wherein is the button class that service end need realize.
In the specific embodiment of the present invention, the exemplary applications of the structure mechanism of CAR member is as follows:
With the graphical control button is example, and it is as follows to produce the Car file earlier:
  module  {      typedef struct{          int x;          int y;      }Position,*PPosition;      interface IButtonSam{          GetPosition(              [out]PPosition pPos);      }      class CButtonSam{          constructor(                      [in]PPosition pos);          interface IButtonSam;      }  }
Constructor wherein ([in] PPosition pos) is the constructed fuction of CButtonSam class, the compiler of CAR file is finding have constructed fuction to exist among the class of car file, can generate has _ CButtonSam_IClassObject_ interface code framework, it comprises interface structure method CARAPI CreateObjectWithPos (PPosition pos, IObject**pNewObj), corresponding to the constructor method:
  ECODE_CButtonSamClassObject_::CreateObjectWithPos(      /*[in]*/PPosition pos,      /*[out]*/IObject**ppNewObj)  {      ECODE_ecode_;      CButtonSam*_pNewObj_;      _ecode_=_CButtonSamCreateObject(IID_IObject,(IObject**)&_pNewObj_);      if(FAILED(_ecode_))return_ecode_;      _ecode_=_pNewObj_->constructor(pos);      if(FAILED(_ecode_)){          _pNewObj_->Release();          return_ecode_;      }      *ppNewObj=(_IObject*)_pNewObj_;      return NOERROR;  }
Wherein:
  CARAPI_CButtonSamCreateObject(RIID riid,IObject**ppObj)  {      ECODE ec;      CButtonSam*pObj=new CButtonSam;      if(!pObj)return E_OUT_OF_MEMORY;      ((_IObject*)pObj)->AddRef();      if(FAILED(ec))goto ErrorExit;      ec=((_IObject*)pObj)->QueryIntefface(riid,ppObj);  ErrorExit:        <!-- SIPO <DP n="6"> -->        <dp n="d6"/>      pObj->Release();      return ec;  }
CLIENT PROGRAM is as long as call corresponding method with the form of interface method and just can finish initialization like this, and the class object to the very similar C++ of use of member that client comprises is constructed, and is as follows:
  EXTERN_C int main(int argc,char**argv)  {      Position pos={100,110},postmp;      IButtonSam*pbs=NULL;      ECODE ec=CButtonSam.New(&pos,&pbs);      if(FAILED(ec)){          printf("Failed to create object with using Positon,ec=0x%08x\n",ec);          goto ErrorExit;      }      printf("Succeed to create button with position{x=%d,y=%d}\n",pos.x,pos.y);      pbs->GetPosition(&postmp);      printf("Get positon:x=%d,y=%d\n",postmp.x,postmp.y);      pbs->Release();  pbs=NULL;  ErrorExit:  if(pbs)pbs->Release();      return 0;  }
Wherein, the realization of New function is to be finished by the following code that the metadata that system provides according to the Car file generates:
  class_CButtonSamClassObject_  {  public:      static ECODE New(                      /*[in]*/PPosition pos,                      /*[out]*/IButtonSam**pIButtonSam)      {          ECODE_ecode=NOERROR;          IObject*_pNewObject=NULL;          _CButtonSam_IClassObject_*_p_CButtonSam_IClassObject_=NULL;          _ecode=EzGetClassObject(CLSID_CButtonSamClassObject_,                      CTX_SAME_DOMAIN,(IObject**)&_p_CButtonSam_IClassObject_);          if(FAILED(_ecode))goto Exit;          _ecode=_p_CButtonSam_IClassObject_->CreateObjectWithPos(pos,&_pNewObject);          if(FAILED(_ecode))goto Exit;          _ecode=_pNewObject->QueryInterface(IID_IButtonSam,(IObject**)pIButtonSam);          if(FAILED(_ecode))goto Exit;      Exit:          if(_pNewObject)_pNewObject->Release();          if(_p_CButtonSam_IClassObject_)_p_CButtonSam_IClassObject_->Release();          return_ecode;  }  };
Adopted the building method in the above-mentioned member initialization procedure, because system comprises the structure interface class code skeleton of constructing interface method according to component interface metadata in the component description file and specific constructed fuction information in the service end generation in initialization procedure, automatically generate corresponding structure call method in client simultaneously, and the result that will operate returns to the user as rreturn value, thereby the long-range make of the member of reliably having realized client and service end, and can support distributed system to use preferably; To construct the result simultaneously and return the user, being convenient to the user handles targetedly, thereby developer's development efficiency and executing efficiency have been improved, reduced development difficulty, strengthened the stability of program run performance, the scope of application is comparatively extensive, for further developing of distributed element software systems established solid foundation.
In this instructions, the present invention is described with reference to its certain embodiments.But, still can make various modifications and conversion obviously and not deviate from the spirit and scope of the present invention.Therefore, instructions and accompanying drawing are regarded in an illustrative, rather than a restrictive.

Claims (6)

1, the building method in a kind of member initialization procedure comprises the service end and the client that are connected by computer network, it is characterized in that described method may further comprise the steps:
(1) system carries out initialization operation;
(2) system operates according to the user, adds component interface descriptor and specific constructed fuction in the component description file;
(3) system reads this component description file, produces metadata of interface, and comprises the structure interface class code skeleton of constructing interface method according to this specific constructed fuction in the service end generation;
(4) system obtains metadata, and generates the structure call method according to this metadata in client;
(5) system is called and metadata information according to the user, produces member class factory object in client;
(6) system is in the corresponding structure of service end inquiry interface class;
(7) corresponding structure interface method calls according to the structure interface class that inquires in system, and operating result is returned as rreturn value, thereby finishes the initialization structure of member.
2, the building method in the member initialization procedure according to claim 1 is characterized in that, the form of described specific constructed fuction is: constructed fuction sign ([input] input parameter).
3, the building method in the member initialization procedure according to claim 1 is characterized in that described constructed fuction is designated constructor.
4, the building method in the member initialization procedure according to claim 2 is characterized in that, the described generation in service end comprises that the structure interface class code skeleton of constructing interface method may further comprise the steps:
(1) generates the code of constructing interface class in service end;
(2) generate the structure interface method of this structure interface class according to described specific constructed fuction, the form of this structure interface method is: error code interface method sign (input parameter, the member pointer), wherein error code is the rreturn value of this structure interface method;
(3) in the implementation of this structure interface method, produce this component object and carry out initialized operation, and member produced and the error code of initialization operation is returned as rreturn value.
5, according to the building method in each described member initialization procedure in the claim 2 to 4, it is characterized in that, describedly generate the structure call method in client and may further comprise the steps:
(1) in client according to the component interface metadata, produce specific constructed fuction and component interface structure call method, the form of this structure call method is: error code building method sign (input parameter, member pointer), and wherein error code is the rreturn value of this structure call method;
(2) in the implementation of this structure call method, produce member class factory object, in the corresponding structure of service end inquiry interface class, call corresponding structure interface method according to this structure interface class and produce the operation that member and initialization are constructed to finish, and the error code of aforesaid operations is returned as rreturn value.
6, the building method in the member initialization procedure according to claim 5 is characterized in that described building method is designated New.
CNB200610029755XA 2006-08-04 2006-08-04 Constructive method for use in member initialization process Expired - Fee Related CN100462914C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200610029755XA CN100462914C (en) 2006-08-04 2006-08-04 Constructive method for use in member initialization process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200610029755XA CN100462914C (en) 2006-08-04 2006-08-04 Constructive method for use in member initialization process

Publications (2)

Publication Number Publication Date
CN1904825A true CN1904825A (en) 2007-01-31
CN100462914C CN100462914C (en) 2009-02-18

Family

ID=37674096

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200610029755XA Expired - Fee Related CN100462914C (en) 2006-08-04 2006-08-04 Constructive method for use in member initialization process

Country Status (1)

Country Link
CN (1) CN100462914C (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6434740B1 (en) * 1998-07-15 2002-08-13 International Business Machines Corporation Apparatus and method for visual construction simplification
CN1313925C (en) * 2002-12-31 2007-05-02 上海科泰世纪科技有限公司 Construction member self description packaging method and method of operation
CN1270229C (en) * 2002-12-31 2006-08-16 上海科泰世纪科技有限公司 Method of realizing cross address space establishing construction member target based on dynamic core
CN1519716B (en) * 2003-01-22 2010-04-28 上海科泰世纪科技有限公司 Method for generating C++ program based on component definition language
US20060036999A1 (en) * 2004-08-13 2006-02-16 Fay Thomas R System and method for managing test and measurement components

Also Published As

Publication number Publication date
CN100462914C (en) 2009-02-18

Similar Documents

Publication Publication Date Title
Mei et al. ABC/ADL: An ADL supporting component composition
Trinder et al. Parallel and distributed Haskells
Aldinucci et al. ASSIST as a research framework for high-performance Grid programming environments
CN1744038A (en) Member assembling method based on united member package structure
WO2009061146A2 (en) A method for software development and operation based on component reuse and dependency injection
EP1695205A2 (en) System and methods for modeling and generating reusable application component frameworks, and automated assembly of service - oriented applications existing applications
CN1577265A (en) Description language for an extensible compiler and tools infrastructure
CN102521024B (en) Job scheduling method based on bioinformation cloud platform
CN1916842A (en) Method of packaging component for implementing reflection mechanism in structurized software system
JP2009238231A (en) Software development method using metadata expanded under component base environment and its development system
CN1737755A (en) Modeling and code generating method of embedded real-time operating system
Gomes et al. A modeling domain-specific language for IoT-enabled operating systems
Bergmayr et al. fREX: fUML-based reverse engineering of executable behavior for software dynamic analysis
US20120254834A1 (en) Melding of mediation flow service component architecture (sca) components
Nobakht et al. Programming and deployment of active objects with application-level scheduling
US8010941B2 (en) Method and system for dynamically generating enterprise java beans during installation of a service component architecture application
CN1904825A (en) Constructive method for use in member initialization process
CN1656447A (en) Software development tool for ensuring links between UML models and the implementation thereof in a CORBA environment
CN101075190A (en) Data engine in resource management platform
CN1900905A (en) Realizing method and its device for detecting descriptive language
CN1519712A (en) Method for running threaded/process in-local/remote based on task/leading routines and ageney components
CN1779636A (en) Method for constructing coupling system
CN1687897A (en) User guided program semi-automatic parallelizing method
Gubała et al. GridSpace–semantic programming environment for the grid
Jouve et al. High-level programming support for robust pervasive computing applications

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1103587

Country of ref document: HK

C14 Grant of patent or utility model
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: GR

Ref document number: 1103587

Country of ref document: HK

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090218

Termination date: 20180804

CF01 Termination of patent right due to non-payment of annual fee