Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vrj::User Class Reference

Representation for Juggler user in multi-user environments. More...

#include <User.h>

List of all members.

Public Methods

 User ()
 Constructs the user. More...

virtual ~User ()
int getId ()
 Returns the ID of the user in the system. More...

std::string getName ()
 Returns the name of the user object. More...

virtual bool config (jccl::ConfigElementPtr element)
 Configures the user object. More...

gadget::PositionProxy * getHeadPosProxy ()
vpr::Interval getHeadUpdateTime ()
float getInterocularDistance ()


Detailed Description

Representation for Juggler user in multi-user environments.

Each user has a system assigned id as well as a string name from the 'user' config element the created the user. These ids can be used to identify a user at set points in a VR Juggler application where user information is is given.

The system-assigned ID number can also be useful to use as an index into a program array (or other data structure) that stores user-specific data (for example, nativgation matrices or input devices).

Definition at line 57 of file User.h.


Constructor & Destructor Documentation

vrj::User::User   [inline]
 

Constructs the user.

Definition at line 61 of file User.h.

00062       : mUserId(-1)
00063       , mName("")
00064       , mInterocularDist(0.0f)
00065    {;}

virtual vrj::User::~User   [inline, virtual]
 

Definition at line 67 of file User.h.

00068    {;}


Member Function Documentation

int vrj::User::getId  
 

Returns the ID of the user in the system.

Postcondition:
-1 => User has not been configured.

Definition at line 46 of file User.cpp.

00047 { return mUserId; }

std::string vrj::User::getName  
 

Returns the name of the user object.

Postcondition:
String name of the head.

Definition at line 49 of file User.cpp.

00050 { return mName; }

bool vrj::User::config jccl::ConfigElementPtr    element [virtual]
 

Configures the user object.

Postcondition:
User has valid ids (int and string). Positional device for user location has been set.

Definition at line 52 of file User.cpp.

References vrjDBG_KERNEL.

00053 {
00054    vprASSERT(element.get() != NULL);
00055    vprASSERT(element->getID() == "user");
00056 
00057    vprDEBUG_BEGIN(vrjDBG_KERNEL, vprDBG_STATE_LVL)
00058       << "vjUser::config: Creating a new user\n" << vprDEBUG_FLUSH;
00059 
00060    // Assign user id
00061    mUserId = mNextUserId++;
00062 
00063    // Setup user name
00064    mName = element->getName();
00065 
00066    // Initialize the head stuff
00067    std::string head_alias = element->getProperty<std::string>("head_position");
00068    mHead.init(head_alias);
00069 
00070    // Initialize interocular distance
00071    mInterocularDist = element->getProperty<float>("interocular_distance");
00072 
00073    if(mInterocularDist == 0.0f)
00074    {
00075       vprDEBUG(vrjDBG_KERNEL,vprDBG_CONFIG_LVL) << clrOutNORM(clrRED, "WARNING:") << "User: " << mName << " has interocular distance is set to 0.0f.  This is probably not what you wanted.\n" << vprDEBUG_FLUSH;
00076    }
00077 
00078    vprDEBUG(vrjDBG_KERNEL,vprDBG_STATE_LVL) << "id: " << mUserId << "   Name:" << mName.c_str()
00079                            << "   head_positon:" << head_alias.c_str()
00080                            << "   interocular_distance:" << mInterocularDist
00081                            << std::endl << vprDEBUG_FLUSH;
00082 
00083    return true;
00084 }

gadget::PositionProxy* vrj::User::getHeadPosProxy   [inline]
 

Definition at line 89 of file User.h.

00090    {
00091       return mHead.getProxy();
00092    }

vpr::Interval vrj::User::getHeadUpdateTime   [inline]
 

Definition at line 94 of file User.h.

00095    { return mHead->getTimeStamp(); }

float vrj::User::getInterocularDistance   [inline]
 

Definition at line 97 of file User.h.

00098    { return mInterocularDist;}


The documentation for this class was generated from the following files:
Generated on Sun May 2 15:11:16 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002