ACT Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ActNamespace Class Reference

The ActNamespace class holds all the information about a namespace. More...

#include <namespaces.h>

Public Member Functions

 ActNamespace (const char *s)
 
 ActNamespace (ActNamespace *ns, const char *s)
 
 ~ActNamespace ()
 
const char * getName ()
 
ActNamespacefindNS (const char *s)
 
UserDeffindType (const char *s)
 
InstTypefindInstance (const char *s)
 
int findName (const char *s)
 
int isExported ()
 
void MkExported ()
 
void clrExported ()
 
ActNamespaceParent ()
 
char * Name (bool add_colon=false)
 
void Unlink ()
 
void Link (ActNamespace *up, const char *name)
 
int CreateType (const char *s, UserDef *u)
 
int EditType (const char *s, UserDef *u)
 
ScopeCurScope ()
 
void Expand ()
 
void enum2Int ()
 
void Print (FILE *fp)
 
int isExpanded ()
 
void setBody (ActBody *b)
 
void AppendBody (ActBody *b)
 
ActBodygetBody ()
 
act_prsgetprs ()
 
act_specgetspec ()
 
act_languagesgetlang ()
 
list_t * getSubNamespaces ()
 
list_t * getProcList ()
 
list_t * getDataList ()
 
list_t * getChanList ()
 

Static Public Member Functions

static void Init ()
 
static ActNamespaceGlobal ()
 
static class ActAct ()
 
static void setAct (class Act *a)
 

Private Member Functions

void _init (ActNamespace *parent, const char *s)
 
void _subst_globals (list_t *subst, InstType *it, const char *s)
 
void _subst_globals_addconn (list_t *subst, listitem_t *start, InstType *it, const char *s)
 

Private Attributes

act_languageslang
 the sub-languages in the namespace
 
hash_bucket_t * self_bucket
 
struct Hashtable * N
 
struct Hashtable * T
 
ScopeI
 
ActBodyB
 
ActNamespaceparent
 
unsigned int exported
 

Static Private Attributes

static ActNamespaceglobal
 
static class Actact
 
static int creating_global
 

Friends

class Act
 
class ActNamespaceiter
 
class ActTypeiter
 

Detailed Description

The ActNamespace class holds all the information about a namespace.

Constructor & Destructor Documentation

◆ ActNamespace() [1/2]

ActNamespace::ActNamespace ( const char *  s)

Create a new namespace in the global scope

Parameters
sis the name of the namespace

◆ ActNamespace() [2/2]

ActNamespace::ActNamespace ( ActNamespace ns,
const char *  s 
)

Create a new namespace in the specified scope

Parameters
sis the name of the new namespace
nsis the parent namespace

◆ ~ActNamespace()

ActNamespace::~ActNamespace ( )

Member Function Documentation

◆ _init()

void ActNamespace::_init ( ActNamespace parent,
const char *  s 
)
private

Internal initialization function shared by the two constructors

Parameters
parentis the parent namespace
sis the name of the new namespace

◆ _subst_globals()

void ActNamespace::_subst_globals ( list_t *  subst,
InstType it,
const char *  s 
)
private

Substitute globals within the namespace

Parameters
substis used to return a list of user-defined types where the globals were substituted.
itis the type of the global
sis the name of the global

◆ _subst_globals_addconn()

void ActNamespace::_subst_globals_addconn ( list_t *  subst,
listitem_t *  start,
InstType it,
const char *  s 
)
private

◆ Act()

static class Act * ActNamespace::Act ( )
inlinestatic
Returns
the Act pointer

◆ AppendBody()

void ActNamespace::AppendBody ( ActBody b)

Append to the current body

Parameters
bis the body to be appended

◆ clrExported()

void ActNamespace::clrExported ( )
inline

Clear the exported flag

◆ CreateType()

int ActNamespace::CreateType ( const char *  s,
UserDef u 
)

Create a new user-defined type in this namespace

Parameters
uis a pointer to the userdefined type
sis the name of the type
Returns
1 if successful, 0 otherwise

◆ CurScope()

Scope * ActNamespace::CurScope ( )
inline

Scope corresponding to this namespace

Returns
current scope

◆ EditType()

int ActNamespace::EditType ( const char *  s,
UserDef u 
)

Edit type: replace the type definition for the type name with the updated definition.

Parameters
uis the new type definition
sis the name of the type to be edited
Returns
1 if successful, 0 if the type name was not found.

◆ enum2Int()

void ActNamespace::enum2Int ( )

Convert any enum Data to an int

◆ Expand()

void ActNamespace::Expand ( )

Expand meta parameters

◆ findInstance()

InstType * ActNamespace::findInstance ( const char *  s)

Lookup instance name in the current namespace

Returns
instance pointer if found, NULL otherwise

◆ findName()

int ActNamespace::findName ( const char *  s)

Lookup names.

Returns
0 if unused name, 1 if it is already a type, and 2 if it is already a namespace, 3 if it is already an instance

◆ findNS()

ActNamespace * ActNamespace::findNS ( const char *  s)

Lookup namespaces in the current namespace scope

Parameters
sis the name of the namespace to be found
Returns
namespace if found, NULL otherwise

◆ findType()

UserDef * ActNamespace::findType ( const char *  s)

Lookup user-defined types in the current namespace

Parameters
sis the name of the type to be found
Returns
Type * if found, NULL otherwise

◆ getBody()

ActBody * ActNamespace::getBody ( )
inline
Returns
the current body of the namespace

◆ getChanList()

list_t * ActNamespace::getChanList ( )
Returns
a list of user-defined channel names

◆ getDataList()

list_t * ActNamespace::getDataList ( )
Returns
a list of user-defined data type names

◆ getlang()

act_languages * ActNamespace::getlang ( )
inline
Returns
the language bodies within this namespace

◆ getName()

const char * ActNamespace::getName ( )
inline

Gets the name of the namespace

Returns
string corresponding to the namespace name

◆ getProcList()

list_t * ActNamespace::getProcList ( )
Returns
a list of process names

◆ getprs()

act_prs * ActNamespace::getprs ( )

helper function to return the prs body

◆ getspec()

act_spec * ActNamespace::getspec ( )

helper function to return the spec body

◆ getSubNamespaces()

list_t * ActNamespace::getSubNamespaces ( )
Returns
a list of char *'s of the names of the sub-namespaces nested within this one

◆ Global()

static ActNamespace * ActNamespace::Global ( )
inlinestatic
Returns
the global namespace

◆ Init()

static void ActNamespace::Init ( )
static

Initialize the namespace module.

◆ isExpanded()

int ActNamespace::isExpanded ( )
inline

Returns 1 if it is expanded

◆ isExported()

int ActNamespace::isExported ( )
inline

Specifies if this is an exported namespace or not

Returns
1 if this is an exported namespace, 0 otherwise

◆ Link()

void ActNamespace::Link ( ActNamespace up,
const char *  name 
)

Link namespace into parent

Parameters
upis the parent namespace
nameis the name of the namespace

◆ MkExported()

void ActNamespace::MkExported ( )
inline

Set this to be an exported namespace

◆ Name()

char * ActNamespace::Name ( bool  add_colon = false)

Returns a freshly allocated string containing the full path to the namespace; append "::" at the end if add_colon is true

◆ Parent()

ActNamespace * ActNamespace::Parent ( )
inline

Provides parent namespace

Returns
parent namespace

◆ Print()

void ActNamespace::Print ( FILE *  fp)

Print text representation

◆ setAct()

static void ActNamespace::setAct ( class Act a)
static

Set the Act pointer

◆ setBody()

void ActNamespace::setBody ( ActBody b)
inline

Replace the body with the one specified

Parameters
bis the new body

◆ Unlink()

void ActNamespace::Unlink ( )

Unlink the namespace from its parent. This function is required for supporting namespace renaming

Friends And Related Function Documentation

◆ Act

friend class Act
friend

◆ ActNamespaceiter

friend class ActNamespaceiter
friend

◆ ActTypeiter

friend class ActTypeiter
friend

Member Data Documentation

◆ act

class Act* ActNamespace::act
staticprivate

pointer to the Act class

◆ B

ActBody* ActNamespace::B
private

namespace body.

◆ creating_global

int ActNamespace::creating_global
staticprivate

used while creating the global namespace

◆ exported

unsigned int ActNamespace::exported
private

if this namespace is exported, set to 1; otherwise zero.

◆ global

ActNamespace* ActNamespace::global
staticprivate

pointer to the global namespace

◆ I

Scope* ActNamespace::I
private

hash table of all the instances within this namespace, encapsulated within the Scope

◆ lang

act_languages* ActNamespace::lang
private

the sub-languages in the namespace

◆ N

struct Hashtable* ActNamespace::N
private

hash table for namespaces nested within this one

◆ parent

ActNamespace* ActNamespace::parent
private

if the namespace is nested, this is a pointer to the parent.

◆ self_bucket

hash_bucket_t* ActNamespace::self_bucket
private

hash table entry for this namespace

◆ T

struct Hashtable* ActNamespace::T
private

hash table of all the types defined within this namespace When a type foo in the namespace is expanded to foo<x,y,z>, then the expanded version is also stored in this hash table.


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