Session Class Reference

#include <Ample.h>

Inheritance diagram for Session:
Inheritance graph
[legend]
Collaboration diagram for Session:
Collaboration graph
[legend]

List of all members.

Classes

class  PendingNode

Public Types

enum  State { CONNECTING, CONNECTED, TERMINATED, RELEASED }
typedef Observer< SessionObserverObserverType
typedef std::vector
< SessionObserver * > 
ObserverList

Public Member Functions

void push (void)
void pop (void)
void terminate (const std::string &byebye)
void release (void)
void createNode (const std::string &name, VNodeType type)
State getState (void) const
NodegetNodeByID (VNodeID ID)
const NodegetNodeByID (VNodeID ID) const
NodegetNodeByIndex (unsigned int index)
const NodegetNodeByIndex (unsigned int index) const
NodegetNodeByName (const std::string &name)
const NodegetNodeByName (const std::string &name) const
unsigned int getNodeCount (void) const
NodegetAvatarNode (void)
const NodegetAvatarNode (void) const
const std::string & getAddress (void) const
unsigned int getDataVersion (void) const
unsigned int getStructureVersion (void) const
void addObserver (SessionObserver &observer)
void removeObserver (SessionObserver &observer)
void removeObserver (Observer< SessionObserver > &observer)
const ObserverListgetObservers (void) const

Static Public Member Functions

static Sessioncreate (const std::string &address, const std::string &username, const std::string &password, unsigned int typeMask=0)
static Sessionfind (const std::string &address)
static void update (uint32 microseconds)
static void terminateAll (const std::string &byebye)
static SessiongetCurrent (void)
static SessiongetByIndex (unsigned int index)
static unsigned int getCount (void)

Detailed Description

Session class. Represents a single session with a verse server.


Member Typedef Documentation

typedef std::vector<SessionObserver *> ObserverList [inherited]
typedef Observer<SessionObserver > ObserverType [inherited]

Member Enumeration Documentation

enum State

Session state enumeration.

Enumerator:
CONNECTING 

The session is still being created.

CONNECTED 

The session is established and exchanging data.

TERMINATED 

The session is terminated. The object will remain for inspection until a new session is created with the same server.

RELEASED 

The session is released, i.e. flagged for deletion. The object will remain until the first subsequent call to Session::update.


Member Function Documentation

void addObserver ( SessionObserver observer  )  [inline, inherited]

Adds the specified observer to this object.

Parameters:
observer The observer to add.
Remarks:
An observer can only be added once. Additional additions are ignored.
static Session* create ( const std::string &  address,
const std::string &  username,
const std::string &  password,
unsigned int  typeMask = 0 
) [static]

Creates a session with the specified verse server.

Parameters:
address The address of the desired verse server.
username The desired user name for the session.
password The password for the specified user.
typeMask A bitmask for the desired node types.
void createNode ( const std::string &  name,
VNodeType  type 
)

Creates a node with the specified name and of the specified type.

Parameters:
name The desired name of the node.
type The desired type of the node.
Remarks:
Due to the structure of the verse protocol, the created node will not immediately receive the specified name.
This call is asynchronous. It will not take effect until, at the earliest, after the first subsequent call to Session::update.
static Session* find ( const std::string &  address  )  [static]

Searches for a session with the specified server address.

Parameters:
address The server address to search for.
Returns:
The session with the specified address, or NULL.
const std::string& getAddress ( void   )  const
Returns:
The address of the verse server for this session.
const Node* getAvatarNode ( void   )  const
Returns:
The avatar node for this session.
Node* getAvatarNode ( void   ) 
Returns:
The avatar node for this session.
static Session* getByIndex ( unsigned int  index  )  [static]
Parameters:
index The index of the desired session.
Returns:
The session with the specified index, or NULL if no such session exists.
static unsigned int getCount ( void   )  [static]
Returns:
The number of sessions.
static Session* getCurrent ( void   )  [static]
Returns:
The active session, or NULL if no session is active.
unsigned int getDataVersion ( void   )  const [inherited]
Returns:
The current version of the internal state.
Remarks:
This value is updated for any kind of change.
const Node* getNodeByID ( VNodeID  ID  )  const
Parameters:
ID The ID of the desired node.
Returns:
The node with the specified ID, or NULL if no such node exists.
Node* getNodeByID ( VNodeID  ID  ) 
Parameters:
ID The ID of the desired node.
Returns:
The node with the specified ID, or NULL if no such node exists.
const Node* getNodeByIndex ( unsigned int  index  )  const
Parameters:
index The index of the desired node.
Returns:
The node at the specified index, or NULL if no such node exists.
Node* getNodeByIndex ( unsigned int  index  ) 
Parameters:
index The index of the desired node.
Returns:
The node at the specified index, or NULL if no such node exists.
const Node* getNodeByName ( const std::string &  name  )  const
Parameters:
name The name of the desired node
Returns:
The node with the specified name, or NULL if no such node exists.
Node* getNodeByName ( const std::string &  name  ) 
Parameters:
name The name of the desired node
Returns:
The node with the specified name, or NULL if no such node exists.
unsigned int getNodeCount ( void   )  const
Returns:
The number of nodes visible in this session.
const ObserverList& getObservers ( void   )  const [inline, inherited]
Returns:
The list of observers attached to this object.
State getState ( void   )  const
Returns:
The state of this session.
unsigned int getStructureVersion ( void   )  const [inherited]
Returns:
The current version of the internal structure.
Remarks:
This value is only updated when the internal structure changes.
void pop ( void   ) 

Pops this session from the internal stack and activates the previous one.

void push ( void   ) 

Pushes this session onto the internal stack and makes it the active session.

void release ( void   ) 

Schedules a terminated session for destruction. Actual destruction will take place at the first subsequent call to Session::update. Note that this call has no effect unless the session is in the terminated state.

void removeObserver ( Observer< SessionObserver > &  observer  )  [inline, inherited]

Removes the specified observer from this object.

Parameters:
observer The observer to remove.
void removeObserver ( SessionObserver observer  )  [inline, inherited]

Removes the specified observer from this object.

Parameters:
observer The observer to remove.
void terminate ( const std::string &  byebye  ) 

Terminates this session with the specified message.

Parameters:
byebye The desired termination message.
Remarks:
This call is asynchronous. It will not take effect until, at the earliest, after the first subsequent call to Session::update.
static void terminateAll ( const std::string &  byebye  )  [static]

Terminates all connected sessions with the specified message.

Parameters:
byebye The desired termination message.
static void update ( uint32  microseconds  )  [static]

Updates all session and associated data. This call will cause all the commands issued and received since the last update to take effect, including triggering observers.

Parameters:
microseconds The maximum number of microseconds to block, when waiting for new commands.

Generated on Thu Nov 19 20:19:30 2009 for Ample by  doxygen 1.6.1