C++ API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Public Static Functions | List of all members
StateManager Class Reference

The StateManager class manages the service application using a collection of plugins.

Public Functions

virtual Guid ApplicationId () const
 
virtual String ApplicationName () const
 
CSI::PureWeb::Server::ICommandManager const & CommandManager () const
 
CSI::PureWeb::Server::ICommandManagerCommandManager ()
 
CSI::PureWeb::Server::IFlowControlManager const & FlowControlManager () const
 
CSI::PureWeb::Server::IFlowControlManagerFlowControlManager ()
 
virtual bool IsStarted () const
 
virtual bool IsStopping () const
 
TypelessStateLock LockAppState ()
 
CSI::PureWeb::Diagnostics::ProfilerManager const & ProfilerManager () const
 
CSI::PureWeb::Diagnostics::ProfilerManagerProfilerManager ()
 
CSI::PureWeb::Server::IRequestManager const & RequestManager () const
 
CSI::PureWeb::Server::IRequestManager & RequestManager ()
 
CSI::PureWeb::Server::IResourceManager const & ResourceManager () const
 
CSI::PureWeb::Server::IResourceManagerResourceManager ()
 
CSI::PureWeb::Server::ISessionStorageManager const & SessionStorageManager () const
 
CSI::PureWeb::Server::ISessionStorageManagerSessionStorageManager ()
 
virtual void Start ()
 
virtual void Stop ()
 
bool TryLockAppState (TimeSpan timeout, TypelessStateLock &lock)
 
CSI::PureWeb::Server::IViewManager const & ViewManager () const
 
CSI::PureWeb::Server::IViewManagerViewManager ()
 
Constructors and Destructors
 StateManager (String const &applicationName)
 
 ~StateManager ()
 
Events
 DEFINE_EVENT (Initialized, StateManager &, EmptyEventArgs)
 
 DEFINE_EVENT (Uninitialized, StateManager &, EmptyEventArgs)
 
 DEFINE_EVENT (RequestReceived, StateManager &, RequestReceivedEventArgs &)
 
 DEFINE_EVENT (ResponsesReady, StateManager &, ResponsesReadyEventArgs &)
 

Public Static Functions

static StateManagerInstance ()
 

Usage Description

void ApplicationId ( ) const
virtual

Gets the unique identifier of this instance of StateManager. This method is for information purposes only. The ID is automatically assigned by PureWeb.

String ApplicationName ( ) const
virtual

Gets the name of this instance of StateManager. This method is for information purposes only.

Gets a constant reference to the CommandManager class.

Gets a reference to the CommandManager class.

DEFINE_EVENT ( Initialized  ,
StateManager ,
EmptyEventArgs   
)

This event is fired once StateManager is initialized.

DEFINE_EVENT ( Uninitialized  ,
StateManager ,
EmptyEventArgs   
)

This event is fired once StateManager is uninitialized.

DEFINE_EVENT ( RequestReceived  ,
StateManager ,
RequestReceivedEventArgs  
)

This event is fired when StateManager receives a request.

DEFINE_EVENT ( ResponsesReady  ,
StateManager ,
ResponsesReadyEventArgs &   
)

This event is fired when StateManager has session responses ready to send.

Gets a constant reference to the FlowControlManager class.

Gets a reference to the the FlowControlManager class.

static StateManager* Instance ( )
inlinestatic

Gets the one and only StateManager instance. Will be null if StateManager is not yet constructed.

bool IsStarted ( ) const
virtual

Gets a Boolean value indicating whether this instance of StateManager is started. This method is for information purposes only, and can be useful when testing or troubleshooting the application.

bool IsStopping ( ) const
virtual

Gets a Boolean value indicating whether this instance of StateManager is stopping. This method is for information purposes only, and can be useful when testing or troubleshooting the application.

TypelessStateLock LockAppState ( )
inline

Acquires a lock on the application state.

In multi-client environments, the application state shouldn't be assumed to be perfectly synchronized, due to network latency or other factors. For this reason, it is possible to request a lock on StateManager, which ensures that no changes to the application state take place while the lock is held. This is needed, for example, if you want to perform atomic changes to multiple paths of the application state tree.

Note
Once you acquire the lock, you will need to use the methods in TypelessStateLock to interact with application state.
CSI::PureWeb::Diagnostics::ProfilerManager const& ProfilerManager ( ) const
inline

Gets a constant reference to the ProfilerManager class.

CSI::PureWeb::Diagnostics::ProfilerManager& ProfilerManager ( )
inline

Gets a reference to the ProfilerManager class.

CSI::PureWeb::Server::IRequestManager const& RequestManager ( ) const
inline

Gets a constant reference to the RequestManager class.

CSI::PureWeb::Server::IRequestManager& RequestManager ( )
inline

Gets a reference to the RequestManager class.

Gets a constant reference to the ResourceManager class.

Gets a reference to the ResourceManager class.

Gets a constant reference to the SessionStorageManager class.

Gets a reference to the SessionStorageManager class.

void Start ( )
virtual

Starts this instance of StateManager. This connects your service application to the PureWeb server, and makes it ready to receive client connections.

void Stop ( )
virtual

Stops this instance of StateManager. This disconnects your service application from the PureWeb server, and makes it unavailable to receive client connections.

bool TryLockAppState ( TimeSpan  timeout,
TypelessStateLock lock 
)
inline

Attempts to acquire a lock on application state before the specified timeout elapses. Returns true if the lock is acquired, or false otherwise.

Parameters
timeoutThe maximum amount of time that StateManager will wait to acquire the lock.
lockThe lock to be acquired.
Note
Once you acquire the lock, you will need to use the methods in TypelessStateLock to interact with application state.

Gets a constant reference to the ViewManager class.

Gets a reference to the ViewManager class.