vrj::User Class Reference

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

#include <vrj/Kernel/User.h>

List of all members.

Public Member Functions

 User ()
 Constructs the user.
virtual ~User ()
int getId ()
 Returns the ID of the user in the system.
std::string getName ()
 Returns the name of this user object.
virtual bool config (jccl::ConfigElementPtr element)
 Configures the user object.
gadget::PositionProxy * getHeadPosProxy ()
vpr::Interval getHeadUpdateTime ()
 Returns the time stamp of the last head tracker update.
float getInterocularDistance ()
 Gets the eye separation.


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 that created the user. These IDs can be used to identify a user at set points in the execution of a VR Juggler application object where user information is given.

The system-assigned ID number can also be useful as an index into a program array (or other data structure) that stores user-specific data such as navigation matrices or input devices.

Definition at line 58 of file User.h.


Constructor & Destructor Documentation

vrj::User::User (  )  [inline]

Constructs the user.

Definition at line 62 of file User.h.

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

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

Definition at line 68 of file User.h.

00069    {;}


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 this user object.

Postcondition:
String name of the head.

Definition at line 49 of file User.cpp.

Referenced by vrj::Viewport::outStream(), and vrj::Kernel::removeUser().

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 90 of file User.h.

Referenced by vrj::PfBasicSimulator::updateInternalData(), vrj::GlBasicSimulator::updateInternalData(), and vrj::SurfaceViewport::updateProjections().

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

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

Returns the time stamp of the last head tracker update.

Definition at line 96 of file User.h.

00097    {
00098       return mHead->getTimeStamp();
00099    }

float vrj::User::getInterocularDistance (  )  [inline]

Gets the eye separation.

Definition at line 102 of file User.h.

Referenced by vrj::GlDrawEllipsoidHeadFunctor::draw(), vrj::PfBasicSimulator::updateProjectionData(), vrj::GlBasicSimulator::updateProjectionData(), and vrj::SurfaceViewport::updateProjections().

00103    {
00104       return mInterocularDist;
00105    }


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:58:31 2007 for VR Juggler by  doxygen 1.5.1