class Object

Almost all classes in Torch should be a sub-class of this class.

Inheritance:


Public Fields

[more]Allocator* allocator
Allocator associated to the Object

Public Methods

[more] Object()
[more]void addOption(const char* name, int size, void* ptr, const char* help="")
Add the option name.
[more]void addIOption(const char* name, int* ptr, int init_value, const char* help="")
Several wrappers of addOption() for Int, Real and Bool options.
[more]void addROption(const char* name, real* ptr, real init_value, const char* help="")
[more]void addBOption(const char* name, bool* ptr, bool init_value, const char* help="")
[more]void addOOption(const char* name, Object** ptr, Object* init_value, const char* help="")
[more]void setOption(const char* name, void* ptr)
Set the option name to the value contained at ptr
[more]void setIOption(const char* name, int option)
Several wrappers of setOption() for Int, Real and Bool options.
[more]void setROption(const char* name, real option)
[more]void setBOption(const char* name, bool option)
[more]void setOOption(const char* name, Object* option)
[more]virtual void loadXFile(XFile* file)
Load the object from a file pointer (not the options)
[more]virtual void saveXFile(XFile* file)
Save the object to a file pointer (not the options)
[more]void load(const char* filename)
Load the machine from a file name (not the options)
[more]void save(const char* filename)
Save the machine to a file name (not the options)
[more]void* operator new(size_t size, Allocator* allocator_=NULL)
Allocate the object using allocator_.
[more]void* operator new(size_t size, Allocator* allocator_, void* ptr_)
Allocate the object using the memory given by ptr_.
[more]void operator delete(void* ptr)
Delete an object


Documentation

Almost all classes in Torch should be a sub-class of this class. It provides two interesting things: first a useful interface to manage option, and second the "allocator trick".

Indeed, in Torch, a class which allocate memory should desallocate this memory when it's destroyed. The idea is the following: in the constructor of Object, an Allocator object is created. You can use it in your subclasses to allocate memory. This memory will be destroyed when the Object is destroyed.

"new" operator have been defined to be used with Allocator.

oAllocator* allocator
Allocator associated to the Object

o Object()

ovoid addOption(const char* name, int size, void* ptr, const char* help="")
Add the option name. This one has a pointer on ptr and has the size size. You can provide an help in help. (Note that if help is empty, its an empty string and not NULL). If the option can be changed at any time, you can set is_allowed_after_init to true.

ovoid addIOption(const char* name, int* ptr, int init_value, const char* help="")
Several wrappers of addOption() for Int, Real and Bool options. Be carefull: there is no type checking.

ovoid addROption(const char* name, real* ptr, real init_value, const char* help="")

ovoid addBOption(const char* name, bool* ptr, bool init_value, const char* help="")

ovoid addOOption(const char* name, Object** ptr, Object* init_value, const char* help="")

ovoid setOption(const char* name, void* ptr)
Set the option name to the value contained at ptr

ovoid setIOption(const char* name, int option)
Several wrappers of setOption() for Int, Real and Bool options. Be carefull: there is no type checking.

ovoid setROption(const char* name, real option)

ovoid setBOption(const char* name, bool option)

ovoid setOOption(const char* name, Object* option)

ovirtual void loadXFile(XFile* file)
Load the object from a file pointer (not the options)

ovirtual void saveXFile(XFile* file)
Save the object to a file pointer (not the options)

ovoid load(const char* filename)
Load the machine from a file name (not the options)

ovoid save(const char* filename)
Save the machine to a file name (not the options)

ovoid* operator new(size_t size, Allocator* allocator_=NULL)
Allocate the object using allocator_. The object will be destroyed and freed when the allocator will be destroyed. If no allocator is provided, the new will be similar than the standard new.

ovoid* operator new(size_t size, Allocator* allocator_, void* ptr_)
Allocate the object using the memory given by ptr_. The object will be destroyed (but not freed!) when the allocator will be destroyed.

ovoid operator delete(void* ptr)
Delete an object


Direct child classes:
XFile
WordSeg
Vocabulary
Vec
Trainer
Timer
Stack
Sequence
QCCache
PreProcessing
PhoneInfo
Perm
Parameters
Measurer
Mat
Machine
LexiconInfo
Kernel
KFold
IOSequenceArray
IOSequence
Grammar
FrameSeg
EditDistance
DataSet
CmdOption
CmdLine
ClassFormat
Author:
Ronan Collobert (collober@idiap.ch)
See Also:
Allocator

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.