/home5/piconepr/public_html/isip/projects/speech/software/documentation/class/math/scalar/String/String.h
// file: $isip/class/string/String/String.h
// version: $Id: String.h 6805 2001-04-23 22:57:41Z peng $
//
// make sure definitions are only made once
//
#ifndef ISIP_STRING
#define ISIP_STRING
// isip include files
//
#ifndef ISIP_SYS_STRING
#include <SysString.h>
#endif
#ifndef ISIP_SOF_PARSER
#include <SofParser.h>
#endif
#ifndef ISIP_MEMORY_MANAGER
#include <MemoryManager.h>
#endif
// String: a class that manages generalized character strings. this class
// inherits the SysString class functionality. we only need to add Sof file
// support and scalar type conversions for the full scalar object.
//
class String : public SysString {
//---------------------------------------------------------------------------
//
// public constants
//
//---------------------------------------------------------------------------
public:
// define the class name
//
static const String CLASS_NAME;
//----------------------------------------
//
// other important constants
//
//----------------------------------------
static const String EMPTY;
//----------------------------------------
//
// default values and arguments
//
//----------------------------------------
// define the default value(s) of the class data
// note we inherit DEF_CAPACITY and DEF_VALUE from SysString class
//
// default arguments to methods
//
static const String DEF_PARAM;
//----------------------------------------
//
// error codes
//
//----------------------------------------
static const long ERR = 21200;
//---------------------------------------------------------------------------
//
// protected data
//
//---------------------------------------------------------------------------
protected:
// a static memory manager
//
static MemoryManager mgr_d;
//---------------------------------------------------------------------------
//
// required public methods
//
//---------------------------------------------------------------------------
public:
// method: name
//
static const String& name() {
return CLASS_NAME;
}
// other static methods
//
static boolean diagnose(Integral::DEBUG debug_level);
// debug methods:
// the setDebug method is inherited from the SysString class
//
boolean debug(const unichar* message) const;
// method: destructor
//
~String() {}
// method: default constructor
//
String(long arg = DEF_CAPACITY) {
setCapacity(arg);
}
// method: copy constructor
//
String(const String& arg) {
SysString::assign(arg);
}
// assign methods:
// these methods are inherited from the SysString class
//
// method: operator=
//
String& operator= (const String& arg) {
assign(arg);
return *this;
}
// method: sofSize
//
long sofSize() const {
return (long)(sizeof(unichar) * length() + sizeof(capacity_d));
}
// other i/o methods
//
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM,
long size = SofParser::FULL_OBJECT,
boolean param = true,
boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
// equality methods:
// these methods are inherited from the SysString class
//
// method: new
//
static void* operator new(size_t size) {
return mgr_d.get();
}
// method: new[]
//
static void* operator new[](size_t size) {
return mgr_d.getBlock(size);
}
// method: delete
//
static void operator delete(void* ptr) {
mgr_d.release(ptr);
}
// method: delete[]
//
static void operator delete[](void* ptr) {
mgr_d.releaseBlock(ptr);
}
// method: setGrowSize
//
static boolean setGrowSize(long grow_size) {
return mgr_d.setGrow(grow_size);
}
// other memory management methods
// these methods are inherited from the SysString class
//
//---------------------------------------------------------------------------
//
// class-specific public methods
//
//---------------------------------------------------------------------------
public:
// method: String
//
String(const unichar* arg) {
SysString::assign(arg);
}
// random alphanumeric string generation methods
//
boolean rand(long min_len = 0, long max_len = MAX_LENGTH);
// method: getEmptyString
//
static const String& getEmptyString() {
static String temp;
return temp;
}
// hash method bounded by input capacity
//
long hash(long capacity_a) const;
//---------------------------------------------------------------------------
//
// private methods
//
//---------------------------------------------------------------------------
private:
};
// end of include file
//
#endif
Up |
Home |
Courses |
Projects |
Proposals |
Publications
Please direct questions or comments to
joseph.picone@isip.piconepress.com