[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Implementation of defined UNITs uses several support classes. Support classes are general library regardless of inside or outside ISIS.
Now, the following support classes are implemented.
4.1 root_object class 4.2 c_array class 4.3 bitvector class 4.4 cyclic_queue class 4.5 limited_counter class 4.6 argument_parser class 4.7 gdb_port class
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
root_object
class is an abstract class which directs to its
derived classes interface for copying objects, transferring streams,
and checking invariant equations. Using this class as a root of
hierarchy, a unique interface can be used in the hierarchy. Hardware
units in ISIS often copies objects and transfers stream through the
interface supported by root_object
class.
root_object
class is an abstract class, and it has pure virtual
functions and virtual functions. Derived classes are required to give
a definition of all pure virtual functions. Definition can be given
to all other virtual functions if required.
int check_invariant(void) const
root_object* new_object(void) const
derived_class : public root_object { public: virtual root_object* new_object(void) const; }; root_object* derived_class::new_object(void) const { return new derived_class; } |
root_object* clone_object(void) const
derived_class : public root_object { public: virtual root_object* new_object(void) const; }; root_object* derived_class::new_object(void) const { return new derived_class(*this); } |
void input(istream&)
void output(ostream&) const
If root_object
is used as a virtual base class,
new_object
function and clone_object
function cannot be
used.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
c_array
class is a container class which holds an array of
specified typed objects. The interface is almost the same as STL
vector
class except that the size of array is fixed. The cost
of execution time is the same as that of integrated array.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
bitvector
is a container class which holds a boolean array.
The interface is almost the same as STL bitset
class except
that the size of array can be changed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cyclic_queue
class is a container class which holds a queue of
specified type objects. The interface is almost the same as STL
queue
class.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
limited_counter
class represents a counter for a limited range.
It is a template class with its value as a parameter. Increment and
decrement are allowed as an operation. The minimum value is 0, and as
the maximum value, arbitrary integer value can be specified. If not
specified, it becomes 1. Operations of ++
and --
are
supported.
value_type max(void) const
value_type value(void) const
bool is_max(void) const
const limited_counter& increment(void)
const limited_counter& decrement(void)
void clear(void)
void set_max(value_type)
bool check_invariant(void) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
argument_parser
class interprets a command line parameter, and
generates a database for reference. It supports four option forms:
`-<char>', `-<char><value>', `--<str>' and
`--<str>=<value>'. Option and non-option can be specified in
any order. All options are registered in the database, and non-option
is registered as a string array similar to the second parameter of
main function. As an exception, when --
is specified in the
command line, following options are treated as non-options.
`-<char>' and `--<str>' have a boolean value true or
false, and `-<char><value>' and `--<str>=<value>' hold
string. For checking the boolean true or not, defined
member
function is used, and for referring the string value, operator
[]
is used. For referring `-<char>' value, character is
given as a key, and for `--<str>', string is given.
defined
function returns true or false. []
operation
returns string if the value is defined, otherwise, NULL
is
returned.
For giving the parameter of the command line input, constructor
parameter or set
member function is used. Usually, the second
parameter of main function argv
plus one should be given. With
this method, command line parameters other than the program itself can
be stored in the database.
The following is a simple example. In this example, the output of number of total clocks is specified with `-c', the number of processors with `-p<n>', verbose output parameters with `--verbose', and the standard output file with `--stdout=<file>', respectively.
int main(int, char** argv) { bool clock_flag = false, verbose_flag = false, punum = true; char* stdout_filename = NULL; argument_parser arg(argv + 1); if (arg.defined('c')) clock_flag = true; if (arg['p'] != NULL) punum = atoi(arg['p']); if (arg.defined("verbose")) verbose_flag = true; if (arg["stdout"] != NULL) stdout_filename = arg["stdout"]; /* ... */ } |
void set(const char* const)
void clear(void)
bool defined(char) const
bool defined(const char*) const
const char* operator[](char) const
const char* operator[](const char*) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gdb port class manages the communication between a simulator and gdb.
It supports communication using TCP and UDP, and packet encoding.
Communication is done only by send
and receive
member
function. The receiving of acknowledge of packet sending and the
sending of acknowledge of packet receiving are done automatically.
use_tcp
or use_udp
to TCP or
UDP.
set_port
.
setup
. If successful, true is
returned.
connect
waits the connection from client.
send
and receive
are used for communication.
disconnect
terminates the connection.
shutdown
terminates the communication.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |