UA Server SDK C++ Bundle  1.4.3.291
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
OpcUa::FileType Class Reference

Class implementing the UaObject interface for the FileType. More...

#include <opcua_filetype.h>

Inherits OpcUa::FileTypeBase.

Public Member Functions

 FileType (const UaNodeId &nodeId, UaObject *pInstanceDeclarationObject, NodeManagerConfig *pNodeConfig, UaMutexRefCounted *pSharedMutex=NULL)
 Construction of the class FileType. More...
 
 FileType (const UaNodeId &nodeId, const UaString &name, OpcUa_UInt16 browseNameNameSpaceIndex, NodeManagerConfig *pNodeConfig, UaMutexRefCounted *pSharedMutex=NULL)
 Construction of the class FileType. More...
 
 FileType (UaBase::Object *pBaseNode, XmlUaNodeFactoryManager *pFactory, NodeManagerConfig *pNodeConfig, UaMutexRefCounted *pSharedMutex=NULL)
 Constructs an instance of the class FileType with all components. More...
 
UaString filePath () const
 Get the file path and name used for this FileType object.
 
bool setFilePath (const UaString &sFilePath)
 Set file path and name used for FileType object.
 
OpcUa_UInt64 maxFileSize () const
 Get maximum file size accepted for writing. More...
 
void setMaxFileSize (OpcUa_UInt64 maxFileSize)
 Set the maximum file size accepted for writing. More...
 
UaFilecreateFileAccessObject (Session *pSession, const UaString &sFileName)
 Creates an object with the interface UaFile used to access the file. More...
 
OpcUa_Boolean checkUserAccess (Session *pSession, UaIODevice::OpenMode openMode)
 Verifies the open mode with the user rights for the file. More...
 

Static Public Member Functions

static void createTypes ()
 Create the type related static members of the class.
 
static void clearStaticMembers ()
 Clear the static members of the class.
 

Protected Member Functions

virtual ~FileType ()
 Destruction.
 

Detailed Description

Class implementing the UaObject interface for the FileType.

The FileType is used to give an OPC UA client access to a file managed by the OPC UA server. After creating a FileType object in the server, the path to the file can be set with FileType::setFilePath

By default the FileType uses the class UaFile for all file access operations. The default behaviour of UaFile can be changed by overwriting FileType::createFileAccessObject. This allows to create a own implementation of UaFile with the application specific behaviour.

The maximum size of the file a client can write to can be limited with FileType::setMaxFileSize. The write access can be set with FileTypeBase::setWritable.

OPC UA Objects are used to represent systems, system components, real-world objects and software objects. They have the NodeClass Object. The detailed description of Objects and their attributes can be found in the general description of the Object node class.

Constructor & Destructor Documentation

OpcUa::FileType::FileType ( const UaNodeId nodeId,
UaObject pInstanceDeclarationObject,
NodeManagerConfig pNodeConfig,
UaMutexRefCounted pSharedMutex = NULL 
)

Construction of the class FileType.

This constructor is used if the object is created based on an instance declaration of an object type. Since the only difference between the instance declaration object and the instance object are the node id, the pointer to the instance declaration node is used to get the attribute values other than NodeId from the instance declaration node.
The object is reference counted and can not be deleted directly. The reference counter is set to one after the object is created. If the object was successfully added to a NodeManager using the methods NodeManagerConfig::addUaNode or NodeManagerConfig::addNodeAndReference the NodeManager will release this reference during shut down. If the object was not added to a NodeManager, it must be deleted using the releaseReference method. If the interface pointer is used in other places, the availability of the object must be ensured by incrementing the reference counter with addReference when the pointer is stored somewhere and decremented with releaseReference if the interface pointer is not longer needed.

Parameters
[in]nodeIdNodeId of the new object
[in]pInstanceDeclarationObjectUaObject interface of the instance declaration node used to provide attribute values other than NodeId
[in]pNodeConfigInterface pointer to the NodeManagerConfig interface used to add and delete node and references in the address space
[in]pSharedMutexShared mutex object used to synchronize access to the object. Can be NULL if no shared mutex is provided
OpcUa::FileType::FileType ( const UaNodeId nodeId,
const UaString name,
OpcUa_UInt16  browseNameNameSpaceIndex,
NodeManagerConfig pNodeConfig,
UaMutexRefCounted pSharedMutex = NULL 
)

Construction of the class FileType.

This constructor is used if the object is not created based on an instance declaration. It defines the name and node id of the object. Additional language specific names and other attribute values can be set with set methods provided by the class. The object is reference counted and can not be deleted directly. The reference counter is set to one after the object is created. If the object was successfully added to a NodeManager using the methods NodeManagerConfig::addUaNode or NodeManagerConfig::addNodeAndReference the NodeManager will release this reference during shut down. If the object was not added to a NodeManager, it must be deleted using the releaseReference method. If the interface pointer is used in other places, the availability of the object must be ensured by incrementing the reference counter with addReference when the pointer is stored somewhere and decremented with releaseReference if the interface pointer is not longer needed.

Parameters
[in]nodeIdNodeId of the new object
[in]nameName of the new object. Used as browse name and also as display name if no additional language specific names are set.
[in]browseNameNameSpaceIndexNamespace index used for the browse name
[in]pNodeConfigInterface pointer to the NodeManagerConfig interface used to add and delete node and references in the address space
[in]pSharedMutexShared mutex object used to synchronize access to the object. Can be NULL if no shared mutex is provided
OpcUa::FileType::FileType ( UaBase::Object pBaseNode,
XmlUaNodeFactoryManager pFactory,
NodeManagerConfig pNodeConfig,
UaMutexRefCounted pSharedMutex = NULL 
)

Constructs an instance of the class FileType with all components.

Parameters
[in]pBaseNodeThe "tree" of nodes that specifies the attributes of the instance and its children
[in]pFactoryThe factory to create the children
[in]pNodeConfigInterface pointer to the NodeManagerConfig interface used to add and delete node and references in the address space
[in]pSharedMutexShared mutex object used to synchronize access to the variable. Can be NULL if no shared mutex is provided

Member Function Documentation

OpcUa_Boolean OpcUa::FileType::checkUserAccess ( Session pSession,
UaIODevice::OpenMode  openMode 
)

Verifies the open mode with the user rights for the file.

The default implementation returns always true. By overwriting this method, the derived class can control access on user level. If the user has not the full rights for the requested openMode, the method returns false.

UaFile * OpcUa::FileType::createFileAccessObject ( Session pSession,
const UaString sFileName 
)

Creates an object with the interface UaFile used to access the file.

The default implementation creates an instance of UaFile. By overwriting this method, the derived class can create an object that has a specialized implementation of UaFile. The passed in session context can be used to control access on user level.

Parameters
[in]pSessionSession context used to access the file. This parameter is only relevant if this method is overwritten by a derived class.
[in]sFileNameName and path of the file to access.
OpcUa_UInt64 OpcUa::FileType::maxFileSize ( ) const

Get maximum file size accepted for writing.

Default value 0 is unlimited.

void OpcUa::FileType::setMaxFileSize ( OpcUa_UInt64  maxFileSize)

Set the maximum file size accepted for writing.

Default value 0 is unlimited.


The documentation for this class was generated from the following files: