Class: TLicenseProviderSession

Declaration: LicenseProvider.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MReferenceCounted

Inherited By:

None.

Purpose:

An abstract base class that models the relationship between a TLicenseUse and a license provider. A TLicenseProviderSession derived class object is created by calling TLicenseProvider::CreateSession.

Instantiation:

Always allocate on the heap.

Deriving Classes:

TLicenseProviderSession is derived by all license providers. The implementation of the Allocate member function must be supplied by the derived class for a complete implementation. It is up to each provider to decide whether to support provider-specific operations; if they are supported, the ExecuteOperations must be supplied by the derived class.

Concurrency:

Not multithread safe.

Resource Use:

The derived class is responsible for returning any unused units back to the license provider when the object is destroyed.

Member Function: TLicenseProviderSession::~TLicenseProviderSession

virtual ~ TLicenseProviderSession ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLicenseProviderSession::GetNumberOfUnits

virtual void GetNumberOfUnits (TLicenseUnit & target) const

Interface Category:

API.

Purpose:

Gets the number of license units available in the session.

Calling Context:

Called by the Licensing framework to evaluate whether it is time for the session to allocate additional license units.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLicenseProviderSession::ConsumeUnits

virtual void ConsumeUnits (TLicenseUnit unitsToConsume)

Interface Category:

API.

Purpose:

Decrements the number of units in the session.

Calling Context:

Called by the Licensing framework to inform the session that the given number of units have been consumed by the product.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLicenseProviderSession::Allocate

virtual void Allocate (TLicenseUnit unitsRequested, TCollectionOf < TProviderOperation > & operations)

Interface Category:

API.

Purpose:

A pure virtual function that is called by the Licensing framework to request licensing units from the license provider. The number of units requested is supplied by the Licensing framework. The TCollectionOf contains a collection of TProviderOperation objects that the product requires the license provider to execute. The TLicenseProviderSession derived class is responsible for updating the number of license units available to the session. This should be done through a call to SetNumberOfUnits. Allocate returns void and should throw an exception for all error conditions.

Calling Context:

Called by TLicenseUse::Check.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLicenseProviderSession::TLicenseProviderSession

TLicenseProviderSession ()

Interface Category:

API.

Purpose:

Default constructor.

Calling Context:

Called by the stream-in operators.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Sets the number of units available to the session at zero.

Member Function: TLicenseProviderSession::SetNumberOfUnits

virtual void SetNumberOfUnits (const TLicenseUnit & units)

Interface Category:

API.

Purpose:

Sets the number of license units available to the session.

Calling Context:

Called by the TLicenseProviderSession derived class to update the number of units available as the result of an Allocate call.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLicenseProviderSession::ExecuteOperations

virtual void ExecuteOperations (TCollectionOf < TProviderOperation > & operations)

Interface Category:

API.

Purpose:

A virtual function that can be overridden by a license provider to implement provider-specific operations. This function is not pure virtual; the base class throws an exception when called. Thus, those providers not choosing to implement provider-specific operations need not implement this function.

Calling Context:

Called by the Licensing framework in its implementation of TLicenseUse::ExecuteOperations to process the licensed product's collection of provider-specific operations.

Parameters:

Return Value:

None.

Exceptions:

The base class throws TLicenseUsageException (TLicenseUsageException::kSubclassDidNotExecuteOperations) if this function is called.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.