Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

BasicType Class Reference

#include <pac.h>

Inheritance diagram for BasicType:

Inheritance graph
[legend]
Collaboration diagram for BasicType:

Collaboration graph
[legend]
List of all members.

Public Types

enum  basic_type { name, pactype, ctype, size }

Public Member Functions

 BasicType (basic_type arg_type)
const char * DataType ()
void do_genParseCode (Output *out, Env *env, const DataPtr &data)
int StaticSize (Env *env) const
bool ByteOrderSensitive () const

Static Public Member Functions

int lookup_basictype (const char *name)

Protected Member Functions

void genDynamicSize (Output *out, Env *env, const DataPtr &data)

Protected Attributes

basic_type type

Member Enumeration Documentation

enum BasicType::basic_type
 

Enumeration values:
name 
pactype 
ctype 
size 

Definition at line 421 of file pac.h.

00421                         {
00422 #               define TYPE_DEF(name, pactype, ctype, size)     name,
00423 #               include "pac_type.def"
00424 #               undef TYPE_DEF
00425         };
00426 
00427         static int lookup_basictype(const char* name);
00428 
00429         BasicType(basic_type arg_type)
00430                 : type(arg_type) 
00431                 {
00432                 if ( type == BasicType::EMPTY )


Constructor & Destructor Documentation

BasicType::BasicType basic_type  arg_type  )  [inline]
 

Definition at line 436 of file pac.h.

00443                                         { return StaticSize(0) >= 2; }


Member Function Documentation

bool BasicType::ByteOrderSensitive  )  const [inline, virtual]
 

Implements Type.

Definition at line 450 of file pac.h.

00451 : public Type

const char * BasicType::DataType  )  [virtual]
 

Implements Type.

Definition at line 764 of file pac.cc.

References ASSERT.

Referenced by StaticSize().

00764         {
00765         /* should never be called */
00766         ASSERT(0);
00767         }

void BasicType::do_genParseCode Output out,
Env env,
const DataPtr data
[virtual]
 

Implements Type.

Definition at line 769 of file pac.cc.

00771         {
00772         // There is no need to generate the size variable
00773         // out_cc->println("%s = sizeof(%s);", size_var, DataType());
00774 
00775         genBoundaryCheck(out_cc, env, data);
00776 
00777         switch ( type ) 
00778                 {
00779                 case EMPTY:
00780                         // do nothing
00781                         break;
00782 
00783                 case INT8:
00784                 case UINT8:
00785                         out_cc->println("%s = *((%s *) (%s));",
00786                                 lvalue, DataType(), data.PtrExpr()); 
00787                         break;
00788                 case INT16:
00789                 case UINT16:
00790                 case INT32:
00791                 case UINT32:
00792                         env->Evaluate(out_cc, &byteorder_id);
00793                         out_cc->println("%s = UnMarshall<%s>(%s, %s, %s);",
00794                                 lvalue, 
00795                                 DataType(), 
00796                                 data.PtrExpr(),
00797                                 lvalue, 
00798                                 env->RValue(&byteorder_id)); 
00799                         break;
00800                 }
00801         }

void BasicType::genDynamicSize Output out,
Env env,
const DataPtr data
[protected, virtual]
 

Implements Type.

Definition at line 763 of file pac.cc.

00764         {
00765         /* should never be called */
00766         ASSERT(0);
00767         }

int BasicType::lookup_basictype const char *  name  )  [static]
 

Definition at line 740 of file pac.cc.

Referenced by yyparse().

00747         {

int BasicType::StaticSize Env env  )  const [virtual]
 

Implements Type.

Definition at line 769 of file pac.cc.

References byteorder_id, DataType(), Env::Evaluate(), Type::genBoundaryCheck(), Output::println(), DataPtr::PtrExpr(), Env::RValue(), and type.


Member Data Documentation

basic_type BasicType::type [protected]
 

Definition at line 453 of file pac.h.

Referenced by StaticSize().


The documentation for this class was generated from the following files:
Generated on Wed Sep 14 03:07:54 2005 for bro_docs by doxygen 1.3.5