xvr2::Group Class Reference

#include <Group.h>

Inheritance diagram for xvr2::Group:

Inheritance graph
[legend]

List of all members.


Detailed Description

This class deals with group management and also provides means to search the system's user group database.

Todo:
Move this class out of the main namespace, probably to xvr2::Platform

Definition at line 28 of file Group.h.


Public Member Functions

 Group ()
 This is the default constructor, it will initialize the internal groupid and groupname to the same one as the current executing process.
 ~Group ()
 Group (int gid)
 This will create a new Group object with groupid gid.
 Group (const String &gname)
 This will create a new Group object with groupname gname.
int getGroupID ()
 This will return the object's numeric group id.
std::string toString ()
 This will return the corresponding groupname as a string.

Static Public Member Functions

static int getCurrentGroupID ()
 This will return the current process's group id.
static int getGroupID (const String &gname)
 This will return the numeric group id corresponding to the string gname.
static int getEffectiveGroupID ()
 This will give the numeric effective group id.
static void setGroupID (int gid)
 This will set the current process group id to gid.
static void setGroupID (const String &gname)
 This will set the current process group name to gname.
static void setGroupID (const Group &grpobj)
 This will set the current process group to grpobj.
static void setEffectiveGroupID (int gid)
 This will set the current process effective group id to gid.
static void setEffectiveGroupID (const String &gname)
 This will set the current process effective group name to gname.
static void setEffectiveGroupID (const Group &grpobj)
 This will set the current process effective group to grpobj.

Protected Member Functions

char * getGroupName (int gid)
 This method will return a groupname based on a numeric group id.
void destroyAll ()
 Internal destructor function DONT USE IT.
void getKernelInfo ()
 This method will update the name and information about the current running kernel.
const char * getUnixName ()
 Use this method to retreives the name of the UNIX version you are currently using.
const char * getNodeName ()
 This method will give you the nodename of your current host machine.
const char * getKernelRelease ()
 This will return your current kernel release string.
const char * getKernelReleaseVersion ()
 This will return your current kernel release version string.
const char * getHostMachine ()
 This will return your current architecture description.
virtual const char * getClassName ()
 Returns the name of the current class.

Static Protected Member Functions

static int getuid ()
 Obtains the current (running) user id.
static int getuid (const String &username)
 Obtain uid from username.
static int getgid ()
 Obtain username from uid TODO: You must create the memory allocation classes if you want to implement the new version of getuid(); DONT FORGET IT!!!!
static int getgid (const String &groupname)
 Obtain uid from username.
static int chown (const String &fname, int userid, int groupid=-1)
 Obtain username from uid TODO: You must create the memory allocation classes if you want to implement the new version of getgid(); DONT FORGET IT!!!!
static int chown (const String &fname, const String &owner)
 Changes the owner of the file by its username.
static int chgrp (const String &fname, int userid)
 Changes the group owner of the file by its numeric userid.
static int chgrp (const String &fname, const String &groupname)
 Changes the group owner of the file by its groupname.
static void usleep (UInt32 usec)
 This will return how many CPUs are installed in the system.
static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Protected Attributes

int _groupid
 Internal numeric group id reference member.
std::string * string_representation
 Internal numeric group id reference member.
char * sysname
 Pointer to system name.
char * nodename
char * release
char * k_version
char * machine
Mutex OSMutex
std::string __cls_name

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)

Constructor & Destructor Documentation

xvr2::Group::Group (  ) 

This is the default constructor, it will initialize the internal groupid and groupname to the same one as the current executing process.

xvr2::Group::~Group (  ) 

xvr2::Group::Group ( int  gid  ) 

This will create a new Group object with groupid gid.

xvr2::Group::Group ( const String gname  ) 

This will create a new Group object with groupname gname.

Parameters:
gname Is the group name to be created


Member Function Documentation

char* xvr2::Group::getGroupName ( int  gid  )  [protected]

This method will return a groupname based on a numeric group id.

BE CAREFULL WHEN USING THIS FUNCTION AND ALLWAYS RELEASE THE POINTER IT RETURN IN ORDER TO PREVENT MEMORY LEAKS

int xvr2::Group::getGroupID (  ) 

This will return the object's numeric group id.

static int xvr2::Group::getCurrentGroupID (  )  [static]

This will return the current process's group id.

static int xvr2::Group::getGroupID ( const String gname  )  [static]

This will return the numeric group id corresponding to the string gname.

static int xvr2::Group::getEffectiveGroupID (  )  [static]

This will give the numeric effective group id.

static void xvr2::Group::setGroupID ( int  gid  )  [static]

This will set the current process group id to gid.

static void xvr2::Group::setGroupID ( const String gname  )  [static]

This will set the current process group name to gname.

static void xvr2::Group::setGroupID ( const Group grpobj  )  [static]

This will set the current process group to grpobj.

static void xvr2::Group::setEffectiveGroupID ( int  gid  )  [static]

This will set the current process effective group id to gid.

static void xvr2::Group::setEffectiveGroupID ( const String gname  )  [static]

This will set the current process effective group name to gname.

static void xvr2::Group::setEffectiveGroupID ( const Group grpobj  )  [static]

This will set the current process effective group to grpobj.

std::string xvr2::Group::toString (  )  [virtual]

This will return the corresponding groupname as a string.

Reimplemented from xvr2::Object.

void xvr2::Unix::destroyAll (  )  [protected, inherited]

Internal destructor function DONT USE IT.

static int xvr2::Unix::getuid (  )  [static, inherited]

Obtains the current (running) user id.

static int xvr2::Unix::getuid ( const String username  )  [static, inherited]

Obtain uid from username.

static int xvr2::Unix::getgid (  )  [static, inherited]

Obtain username from uid TODO: You must create the memory allocation classes if you want to implement the new version of getuid(); DONT FORGET IT!!!!

Obtains the current (running) user id

static int xvr2::Unix::getgid ( const String groupname  )  [static, inherited]

Obtain uid from username.

static int xvr2::Unix::chown ( const String fname,
int  userid,
int  groupid = -1 
) [static, inherited]

Obtain username from uid TODO: You must create the memory allocation classes if you want to implement the new version of getgid(); DONT FORGET IT!!!!

Changes the owner of the file by its numeric userid

static int xvr2::Unix::chown ( const String fname,
const String owner 
) [static, inherited]

Changes the owner of the file by its username.

static int xvr2::Unix::chgrp ( const String fname,
int  userid 
) [static, inherited]

Changes the group owner of the file by its numeric userid.

static int xvr2::Unix::chgrp ( const String fname,
const String groupname 
) [static, inherited]

Changes the group owner of the file by its groupname.

void xvr2::Unix::getKernelInfo (  )  [inherited]

This method will update the name and information about the current running kernel.

const char* xvr2::Unix::getUnixName (  )  [inherited]

Use this method to retreives the name of the UNIX version you are currently using.

const char* xvr2::Unix::getNodeName (  )  [inherited]

This method will give you the nodename of your current host machine.

const char* xvr2::Unix::getKernelRelease (  )  [inherited]

This will return your current kernel release string.

const char* xvr2::Unix::getKernelReleaseVersion (  )  [inherited]

This will return your current kernel release version string.

const char* xvr2::Unix::getHostMachine (  )  [inherited]

This will return your current architecture description.

static void xvr2::System::usleep ( UInt32  usec  )  [static, inherited]

This will return how many CPUs are installed in the system.

This will return the CPU speed in megahertz Will return the total amount of system memory Will return the total amount of free system memory Will freeze the software for usec microseconds

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

int xvr2::Group::_groupid [protected]

Internal numeric group id reference member.

Definition at line 31 of file Group.h.

std::string* xvr2::Group::string_representation [protected]

Internal numeric group id reference member.

Definition at line 34 of file Group.h.

char* xvr2::Unix::sysname [protected, inherited]

Pointer to system name.

Definition at line 28 of file Unix.h.

char* xvr2::Unix::nodename [protected, inherited]

Definition at line 29 of file Unix.h.

char* xvr2::Unix::release [protected, inherited]

Definition at line 30 of file Unix.h.

char* xvr2::Unix::k_version [protected, inherited]

Definition at line 31 of file Unix.h.

char* xvr2::Unix::machine [protected, inherited]

Definition at line 32 of file Unix.h.

Mutex xvr2::Unix::OSMutex [protected, inherited]

Definition at line 34 of file Unix.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


The documentation for this class was generated from the following file:

Generated on Fri Jun 20 22:55:54 2008 for X-VR2 SDK by  doxygen 1.5.5