Class Pzl: различия между версиями

Материал из wikiru.visual-prolog.com

Строка 188: Строка 188:
==pzl::getContainerName/0==
==pzl::getContainerName/0==
{{predicate|
{{predicate|
decl=<vip>getContainerName:()->string ThisContainerName procedure ().
decl=<vip>getContainerName:()->string ThisContainerName procedure ().</vip>
</vip>
|short=Get the name of the file-container, where the given component is placed
|short=Get the name of the file-container, where the given component is placed
|full=Returnes the name (full path) of the file where the given pzl-component is placed.
|full=Returnes the name (full path) of the file where the given pzl-component is placed.
Строка 199: Строка 198:
...
...
</vip>
</vip>
}}
==pzl::getContainerVersion/0==
{{predicate|
decl=<vip>getContainerVersion:()->string ThisContainerVersion procedure ()</vip>
|short=Get the identifier of the container version, where the given component is placed
|full=Returnes the version of the pzl-container, where the given component placed.
The version of the container declared as the value of the string type (string). It is defined by the constant "pzlContainerVersion_C" in the file PzlConfig.i of the container project.
|example=
If the file PzlConfig.i of the given container contains the constant declaration
<vip>constants
  pzlContainerVersion_C="1.0;001".</vip>
then the following code gets the version No of the given container
<vip>...
ContainerVersion=pzl::getContainerVersion(),
stdIO::writef("Container Version - %",ContainerVersion),
...</vip>
It will be sent to the output stream: "Container version - 1.0;001"
}}
}}


[[Category:VpPuZzle]]
[[Category:VpPuZzle]]

Версия 11:54, 25 января 2008

Автор: Виктор Юхтенко

Purpose

The destination of the class Pzl is to support the use of pzl-components and to get information regarding the status of the pzl-system. The class Pzl must be included into any project, which deals with pzl-components. Such a project may be both the pzl-container and the project generating the executable application.

The implementation of the class Pzl contained:

  • if to pzl-container (DLL-container) - at the pzlContainer_YY.lib static library
  • if to main executable application - at pzlPort_XX.lib static library

where YY and XX - appropriate license levels.

Any class, which included into the project and which uses the pzl-technology may use the predicates of the class Pzl.

The list of domains used by the class

pzlComponentsRegisterFileName_D The status of the file-registry of the given application
pzlContainerContentInfo_D Information regarding the components of the pzl-container
pzlComponentInfo_D The desriptor of the pzl-component
entityUID_D The identifier of the entity

The list of predicates of the class Pzl

The list of predicates of the class Pzl is divided on sublists (the standard VIP-predicate classInfo is not considered):

  • Container Information
This group is not for use in the ordinary programming. It serves to get the information regardng the container, such as the level of the license, information regarding components etc..
  • Component handling
This group of predicates gives the possibility to create instances of components using their identifiers and nicnames.<br\>This group also contains the predicate to assign the standard output flow. If you use the standard style of VIP programming, then you use this set of predicates rare.
  • Object registration
This group of predicates is frequently used one. It serves to register active objects and to get information regarding currently active objects. The object registry is accessible from the any part of the application based on the pzl-technology.
  • Special predicates
The special predicates used by special tools. Not for use by end users.
classInfo.
Get information about the version and the date of the latest modification of the class Pzl
Container Information
getContainerName:()->string ThisContainerName procedure ().
Get the name of the file-container, where the given component is placed
getContainerVersion:()->string ThisContainerVersion procedure ().
Get the identifier of the version of the container, where the given component is placed
getLicenseLevel:()->string PZLUserLicenseLevel procedure ().
Get the name of the license level of the container, where the given component is placed
getComponentRegisterFileName:()->pzlDomains::pzlComponentsRegisterFileName_D ComponentRegisterFileName procedure ().
Get the name of the component registry file, assigned to the current application
getContainerContentList:(string PZLContainerFileName)->pzlDomains::pzlContainerContentInfo_D ContentInfo procedure (i).
Get the list of components, contained in the container with the given name
Component handling
setStdOutputStream:(outputStream OutputStream).
Assign the specified OutputStream as the standard output stream for all components used by the given application
newByName:(string Name,object InObject)->object OutObject procedure (i,i).
Create new object using the name of the component
newByID:(pzlDomains::entityUID_D,object InObject)->object OutObject.
Create new object using the component identifier
Object registration
register:(string ObjectName,object Object) procedure (i,i).
Register the Object using the given ObjectName (single registration)
registerMulti:(string ObjectName,object Object) procedure (i,i).
Register the Object using the given ObjectName ObjectName (possible multiple registration)
getObjectByName_nd:(string ObjectName)->object Object nondeterm (i).
Get the Object, registered previously using the given name ObjectName
getNameByObject_nd:(object Object)->string ObjectNameLow nondeterm (i).
Get the ObjectNames for given Object
getNameAndObject_nd:(string ObjectName,object Object) nondeterm (o,o).
Gen Object and it's assosiated name ObjectName
unRegister:(string ObjectName,object Object) procedure (i,i).
Deregister the given Object with the given ObjectName
unRegisterByName:(string ObjectName) procedure (i).
Deregister all abjects with the given name ObjectName
unRegisterByObject:(object Object) procedure (i).
Deregister given object Object
unRegisterAll:() procedure ().
Deregister all objects (clear the object registry)
Special predicates. Not documented
releaseInactiveContainers:().
getContainerActivity_nd:(string FileName,unsigned RefCounter) nondeterm (o,o).
getContainerToBeUnloaded_nd:(string FileName) nondeterm (o).
subscribe:(notificationAgency::notificationListener NotificationListener).
unSubscribe:(notificationAgency::notificationListener NotificationListener).
newInstance:().
release:().

Other resources used

  • The class Pzl uses the pzlPort_XX.lib library, if the target is executable application (.EXE). Class Pzl uses pzlContainer_XX library, if the target is Dll-contaner (DLL). Actually these libraries contain the class Pzl implementation.
  • It is necessary to have the package pzlConfig.

Domain details

pzlDomains::pzlComponentsRegisterFileName_D

The status of the component registry file

pzlComponentsRegisterFileName_D=
  pzlRegistryFileName(string FileName);
  pzlRegistryFileNameWronglyDefined;
  pzlRegistryFileNameNotInUse.

The domain pzlComponentsRegisterFileName_D defines one of the statuses of the component registry file for the given applicaion.

pzlRegistryFileName(string FileName)
The file FileName assigned as the component registry file.
pzlRegistryFileNameWronglyDefined
The component registry file wrongly defined. Possibly the file not existed, when assignment was done.
pzlRegistryFileNameNotInUse
There was no component registry file assignment.

pzlDomains::entityUID_D

The domain entityUID_D helps to identify different entities. It may have two variants:

  • simple form str(string)
  • complex form uid(...), which corresponds to the nativeGuid of the Visual Prolog, which in turn corresponds to the GUID of the Microsoft company.

The simple form doesn’t provide the uniqueness of the identifiers. It is recommended to use in examples and in the exercises.

The complex form provides the uniqueness of the identifiers. It is not convenient to remember and to manipulate.

domains
  entityUID_D =
    str(string StringIdentifier);
    uid(
       core::unsigned32 Unsigned,
       core::unsigned16 Short1,
       core::unsigned16 Short2,
       core::unsigned8 Byte1,
       core::unsigned8 Byte2,
       core::unsigned8 Byte3,
       core::unsigned8 Byte4,
       core::unsigned8 Byte5,
       core::unsigned8 Byte6,
       core::unsigned8 Byte7,
       core::unsigned8 Byte8
       ).

pzlDomains::pzlContainerContentInfo_D, pzlDomains::pzlComponentInfo_D

The Domain pzlContainerContentInfo_D used to describe the content of the pzl-containers. It is represented as the list of descriptions of components.

pzlContainerContentInfo_D = pzlComponentInfo_D*.

Each element of the list is the term of the domain pzlComponentInfo_D

pzlComponentInfo_D=pzlComponentInfo
  (
  string Alias,
  entityUID_D ComponentID,
  booleanInt Runable,
  core::namedValue_List UserDefinedInfo
  )

Here

  • Alias – the string name of the component,
  • ComponentID – component identifier
  • Runable – Boolean flag, which shows whether the component can be called and can run independently.
  • UserDefinedInfo – the list of parameters interpreted by the developer of the component.

Predicate details

pzl::getContainerName/0

getContainerName:()->string ThisContainerName procedure ().

Get the name of the file-container, where the given component is placed

Description

Returnes the name (full path) of the file where the given pzl-component is placed.

Exceptions

No

Example

...
ContainerName=pzl::getContainerName(),
stdIO::writef("Component /"MyComponent/" placed at container %",ContainerName),
...

pzl::getContainerVersion/0

getContainerVersion:()->string ThisContainerVersion procedure ()

Get the identifier of the container version, where the given component is placed

Description

Returnes the version of the pzl-container, where the given component placed. The version of the container declared as the value of the string type (string). It is defined by the constant "pzlContainerVersion_C" in the file PzlConfig.i of the container project.

Exceptions

No

Example

If the file PzlConfig.i of the given container contains the constant declaration

constants
  pzlContainerVersion_C="1.0;001".

then the following code gets the version No of the given container

...
ContainerVersion=pzl::getContainerVersion(),
stdIO::writef("Container Version - %",ContainerVersion),
...

It will be sent to the output stream: "Container version - 1.0;001"