Difference between revisions of "Class PzlPort"
m (New page: {{spbCopyright}} '''package PzlPort''' The class pzlPort is the core of the VpPuzzle system and supports the use of pzl-components. This class must be included to the project, which gene...) |
Kari Rastas (talk | contribs) m (→pzlPort::setComponentRegisterFileName/1: some spelling errors corrected) |
||
Line 67: | Line 67: | ||
Set the name of the component registry file | Set the name of the component registry file | ||
|full= | |full= | ||
The file ComponentRegisterFileName is one of the places, where the information regarding the pzl-components at the given computer is stored. The other place of store is the Windows registry. When the | The file ComponentRegisterFileName is one of the places, where the information regarding the pzl-components at the given computer is stored. The other place of store is the Windows registry. When the searching process runs the component registry file is used first. If the file doesn't exist or the component is not registered there, then the search process continued in the Windows registry. | ||
The information in the component registry file is stored in the Visual Prolog term format (save-consult data format). Before the component may be used at the given computer, it must be registered at this computer. The | The information in the component registry file is stored in the Visual Prolog term format (save-consult data format). Before the component may be used at the given computer, it must be registered at this computer. The application, which uses the pzl-technology may avoid the use of the component registry file or the application may assign the use of the file by using the predicate setComponentRegisterFileName/1. | ||
The parameter ''ComponentRegisterFileName'' must be the full path to the file, or it may be relative to the directory, where the main | The parameter ''ComponentRegisterFileName'' must be the full path to the file, or it may be relative to the directory, where the main application is placed. | ||
The file extension is not strongly defined in the pzl-system. The recommended file extension is - '''.PZR'''. | The file extension is not strongly defined in the pzl-system. The recommended file extension is - '''.PZR'''. | ||
The component registration file of the | The component registration file of the application may be assigned only once. While the repetitive assignment the existence of the previous assignment is not checked. | ||
The component registration data is load only once while the first access to an any pzl-component. Thus the second (and further) file assignment is not make influence on the component registration. | The component registration data is load only once while the first access to an any pzl-component. Thus the second (and further) file assignment is not make influence on the component registration. |
Revision as of 09:49, 28 November 2009
Written by Victor Yukhtenko. Email: victor@pdc.spb.su
package PzlPort
The class pzlPort is the core of the VpPuzzle system and supports the use of pzl-components. This class must be included to the project, which generates the main executable applicaion(.EXE).
The calls of the predicates of the class PzlPort are possible only from the classes of the main executable applicaion project. Components placed to the dll-containers can not make a calls of the predicats of the class PzlPort.
Predicate summary
classInfo.
get the information regarding the class |
init:().
Initialization of the VpPuZzle system |
setComponentRegisterFileName:(string ComponentRegisterFileName).
Set the name of the component registry file |
isInitialized:() determ.
Checking of the initialization status of the VpPuZzle system |
Additionally used resources
The mandatory use:
- the pzlPort_XX.lib library must be used, where XX - license qualifier. The library in fact contains the implementation of the class PzlPort and also the library includes the implementation of the handling of the pzl-container of the main executable application.
- the package pzlConfig must be used. The package PzlConfig participates in the initialization procedure.
Predicate details
core::classInfo/0
classInfo:().
get the information regarding the class
Description
The predicate is the tipical predicate, which is generated when any class generated automatically by the IDE of the Visual Prolog System
Exceptions
No
Example
No
pzlPort::init/0
init:().
Initialization of the VpPuZzle system
Description
The predicate must be the first predicate, which is used while the accessing to the Pzl-system. It must be called only once. After initialization the calls to other classes of the Pzl system become possible.
The initialization of the pzl-system may be performed immidiately after the main applicaion start. It also may be performed at any moment when the pzl-system is expected to be used. The deinitialization of the pzl-system is impossible.
The repetitions of the initialization are ignored.
Exceptions
No
Example
clauses run():- pzlPort::init(), TaskWindow = taskWindow::new(), ...
pzlPort::setComponentRegisterFileName/1
setComponentRegisterFileName:(string ComponentRegisterFileName).
Set the name of the component registry file
Description
The file ComponentRegisterFileName is one of the places, where the information regarding the pzl-components at the given computer is stored. The other place of store is the Windows registry. When the searching process runs the component registry file is used first. If the file doesn't exist or the component is not registered there, then the search process continued in the Windows registry.
The information in the component registry file is stored in the Visual Prolog term format (save-consult data format). Before the component may be used at the given computer, it must be registered at this computer. The application, which uses the pzl-technology may avoid the use of the component registry file or the application may assign the use of the file by using the predicate setComponentRegisterFileName/1.
The parameter ComponentRegisterFileName must be the full path to the file, or it may be relative to the directory, where the main application is placed. The file extension is not strongly defined in the pzl-system. The recommended file extension is - .PZR.
The component registration file of the application may be assigned only once. While the repetitive assignment the existence of the previous assignment is not checked.
The component registration data is load only once while the first access to an any pzl-component. Thus the second (and further) file assignment is not make influence on the component registration.
The content validation of the file ComponentRegisterFileName while the predicate setComponentRegisterFileName performing is not used. But the file must exist.
It is possible to get the name of the component registration file, assigned at the pzl-system by the use of the predicate call
RegistryFileStatus=pzl::getComponentRegisterFileName()
The predicate pzl::getComponentRegisterFileName() returns the term, which reflects the status of the assignment of the file. If the file name has been assigned successfully, then the name will be returned as the parameter of the term.
Exceptions
If there is no file with the given name ComponentRegisterFileName, then the exception is genereated with the text
"The file <ComponentRegisterFileName> can not be found"
While checking the file existence the system exception are possible and they are stored with the message
"System Error while checking the file <ComponentRegisterFileName> existence"
The error code will be stored also.
Example
class predicates runProfile:(window TaskWindow,string RegistryFileName,string InitialComponent). clauses runProfile(_TaskWindow,RegistryFileName,_InitialComponent):- not(RegistryFileName=""), trap(pzlPort::setComponentRegisterFileName(RegistryFileName),_Err,fail()), fail. runProfile(TaskWindow,RegistryFileName,InitialComponent):- RegistryFileStatus=pzl::getComponentRegisterFileName(), notifyUser(TaskWindow,RegistryFileStatus,RegistryFileName), runStudioStarter(TaskWindow,InitialComponent).
pzlPort::isInitialized/0
isInitialized:() determ.
Checking of the initialization status of the VpPuZzle system
Description
Makes it possible to check whether the initialization of the pzl-system was performed. If the result of the check is positive, then predicate succeeds.
Exceptions
No
Example
clauses run():- not(isInitialazed()), pzlPort::init(), fail. run():- TaskWindow = taskWindow::new(), ...