Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

clawsoft::Console Class Reference

#include <Console.h>

Inheritance diagram for clawsoft::Console:

Inheritance graph
[legend]
Collaboration diagram for clawsoft::Console:

Collaboration graph
[legend]

Detailed Description

This class represents the console object, use to retreive and send data to the current Unix console.

STATUS: READY TO TEST


Public Methods

 Console ()
 Default constructor, this will set the standard output TextOutput to stdout,.

 ~Console ()
 If you didnt changed the output and error TextOuputs then this destructor will clear the references to out and err.

void setOutput (TextOutput *to=0)
 This will reset the standard output to stdout by default or to to.

void setInput (TextInput *ti=0)
 This will reset the standard input to stdin by default or to ti.

void setErrorOutput (TextOutput *te=0)
 This will reset the standard error to stderr by default or to te.

void outWrite (const void *buf, Uint32 siz)
 this will write siz bytes of buf buffer to the current out TextOutput

void outWrite (const String &text)
 This will write the contents of text to the current out TextOutput.

void outWriteLine (const void *buf, Uint32 siz)
 this will write siz bytes of buf buffer to the current out TextOutput plus a newline character

void outWriteLine (const String &text)
 This will write the contents of text to the current out TextOutput plus a newline.

void errWrite (const void *buf, Uint32 siz)
 this will write siz bytes of buf buffer to the current err TextOutput

void errWrite (const String &text)
 This will write the contents of text to the current err TextOutput.

void errWriteLine (const void *buf, Uint32 siz)
 this will write siz bytes of buf buffer to the current err TextOutput plus a newline character

void errWriteLine (const String &text)
 This will write the contents of text to the current err TextOutput plus a newline.

void read (void *buf, Uint32 size)
 This will read size bytes from the current in and will store them on buf.

void readLine (String &line)
 This will read a line of text, a line is a string terminated by \n or \0 the result will be stored on line.

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.

const char * getClassName ()
 Returns the name of the current class.


Static Public Methods

int getuid ()
 Obtains the current (running) user id.

int getuid (const String &username)
 Obtain uid from username.

int getgid ()
 Obtains the current (running) user id.

int getgid (const String &groupname)
 Obtain uid from username.

int chown (const String &fname, int userid, int groupid=-1)
 Changes the owner of the file by its numeric userid.

int chown (const String &fname, const String &owner)
 Changes the owner of the file by its username.

int chgrp (const String &fname, int userid)
 Changes the group owner of the file by its numeric userid.

int chgrp (const String &fname, const String &groupname)
 Changes the group owner of the file by its groupname.

int installedCPUs ()
 This will return how many CPUs are installed in the system.

double cpuSpeed ()
 This will return the CPU speed in megahertz.

int totalMemory ()
 Will return the total amount of system memory.

int freeMemory ()
 Will return the total amount of free system memory.

void usleep (Uint32 usec)
 Will freeze the software for usec microseconds.


Protected Methods

void setClassName (const char *n)
 Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.


Protected Attributes

TextOutputerr
 This will represent the stderr.

TextOutputout
 This will represent the stdout.

TextInputin
 This will represent the stdin.

bool using_builtin_out
 This flag will say if you are using the builtin TextOutput object or a user-defined one for stdout.

bool using_builtin_err
 This flag will say if you are using the builtin TextOutput object or a user-defined one for stderr.

bool using_builtin_in
 This flag will say if you are using the builtin TextInput object or a user-defined one for stdin.

char * sysname
 Pointer to system name.


Constructor & Destructor Documentation

clawsoft::Console::Console  
 

Default constructor, this will set the standard output TextOutput to stdout,.

standard error TextOutput to stderr

clawsoft::Console::~Console  
 

If you didnt changed the output and error TextOuputs then this destructor will clear the references to out and err.


Member Function Documentation

int clawsoft::Unix::chgrp const String   fname,
const String   groupname
[static, inherited]
 

Changes the group owner of the file by its groupname.

int clawsoft::Unix::chgrp const String   fname,
int    userid
[static, inherited]
 

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

int clawsoft::Unix::chown const String   fname,
const String   owner
[static, inherited]
 

Changes the owner of the file by its username.

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

Changes the owner of the file by its numeric userid.

double clawsoft::System::cpuSpeed   [static, inherited]
 

This will return the CPU speed in megahertz.

void clawsoft::Console::errWrite const String   text
 

This will write the contents of text to the current err TextOutput.

void clawsoft::Console::errWrite const void *    buf,
Uint32    siz
 

this will write siz bytes of buf buffer to the current err TextOutput

void clawsoft::Console::errWriteLine const String   text
 

This will write the contents of text to the current err TextOutput plus a newline.

void clawsoft::Console::errWriteLine const void *    buf,
Uint32    siz
 

this will write siz bytes of buf buffer to the current err TextOutput plus a newline character

int clawsoft::System::freeMemory   [static, inherited]
 

Will return the total amount of free system memory.

const char * clawsoft::Object::getClassName   [inherited]
 

Returns the name of the current class.

int clawsoft::Unix::getgid const String   groupname [static, inherited]
 

Obtain uid from username.

int clawsoft::Unix::getgid   [static, inherited]
 

Obtains the current (running) user id.

const char * clawsoft::Unix::getHostMachine   [inherited]
 

This will return your current architecture description.

void clawsoft::Unix::getKernelInfo   [inherited]
 

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

const char * clawsoft::Unix::getKernelRelease   [inherited]
 

This will return your current kernel release string.

const char * clawsoft::Unix::getKernelReleaseVersion   [inherited]
 

This will return your current kernel release version string.

const char * clawsoft::Unix::getNodeName   [inherited]
 

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

int clawsoft::Unix::getuid const String   username [static, inherited]
 

Obtain uid from username.

int clawsoft::Unix::getuid   [static, inherited]
 

Obtains the current (running) user id.

const char * clawsoft::Unix::getUnixName   [inherited]
 

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

int clawsoft::System::installedCPUs   [static, inherited]
 

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

void clawsoft::Console::outWrite const String   text
 

This will write the contents of text to the current out TextOutput.

void clawsoft::Console::outWrite const void *    buf,
Uint32    siz
 

this will write siz bytes of buf buffer to the current out TextOutput

void clawsoft::Console::outWriteLine const String   text
 

This will write the contents of text to the current out TextOutput plus a newline.

void clawsoft::Console::outWriteLine const void *    buf,
Uint32    siz
 

this will write siz bytes of buf buffer to the current out TextOutput plus a newline character

void clawsoft::Console::read void *    buf,
Uint32    size
 

This will read size bytes from the current in and will store them on buf.

void clawsoft::Console::readLine String   line
 

This will read a line of text, a line is a string terminated by \n or \0 the result will be stored on line.

void clawsoft::Object::setClassName const char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

void clawsoft::Console::setErrorOutput TextOutput   te = 0
 

This will reset the standard error to stderr by default or to te.

void clawsoft::Console::setInput TextInput   ti = 0
 

This will reset the standard input to stdin by default or to ti.

void clawsoft::Console::setOutput TextOutput   to = 0
 

This will reset the standard output to stdout by default or to to.

int clawsoft::System::totalMemory   [static, inherited]
 

Will return the total amount of system memory.

void clawsoft::System::usleep Uint32    usec [static, inherited]
 

Will freeze the software for usec microseconds.


Field Documentation

TextOutput* clawsoft::Console::err [protected]
 

This will represent the stderr.

TextInput* clawsoft::Console::in [protected]
 

This will represent the stdin.

TextOutput* clawsoft::Console::out [protected]
 

This will represent the stdout.

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

Pointer to system name.

bool clawsoft::Console::using_builtin_err [protected]
 

This flag will say if you are using the builtin TextOutput object or a user-defined one for stderr.

bool clawsoft::Console::using_builtin_in [protected]
 

This flag will say if you are using the builtin TextInput object or a user-defined one for stdin.

bool clawsoft::Console::using_builtin_out [protected]
 

This flag will say if you are using the builtin TextOutput object or a user-defined one for stdout.


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

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo