TStandardServiceDefinition acts as a wrapper for the classes that derive from TServiceDefinition. The parameters you pass into the TStandardServiceDefinition constructor determines whether the framework instantiates a TLocalServiceDefinition or a TNetworkServiceDefinition object.
NOTE
Service definitions cannot be copied or streamed.
To create a service definition:
- Define a service name by creating a TLocalObjectName object, passing into the constructor:
- A TLocalObjectType object, representing the general type of service (such as a printer or a file server).
- A TLocalObjectInstance object, representing the particular instance of the service--such as the name of the printer or file server--if more than one instance of the service type exists. This parameter is optional.
This code instantiates a TLocalObjectName specifying only a TLocalObjectType.
TLocalObjectType kServiceName = "Calculator" ;
const TLocalObjectName nameOfService( kServiceName ) ;
- Define the visibility of the service using TQualityOfService, specifying the TQualityOfService identifier that matches the level of visibility you want:
|
kSameHost
|
Local visibility--only clients on the same host can see this service
|
|
kNetwork
|
Network visibility--can be accessed by service references on the same host or on any host connected to this host by a mutually interoperable networking protocol
|
|
kNone
|
Visibility not yet defined
|
This line of code specifies local visibility:
TQualityOfService serviceVisibility ( TQualityOfService::kSameHost ) ;
- Instantiate TStandardServiceDefinition, passing in the TLocalObjectName and TQualityOfService objects.
This example creates a service definition visible only to local clients (clients on the same host).
TServiceDefinition* myServiceDefinition
= new TStandardServiceDefinition ( nameOfService, serviceVisibility) ;
myServiceDefinition->AddReference () ;
NOTE
To create an unnamed service, instantiate TStandardServiceDefinition without passing any parameters into the constructor.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker