#include <sc_object.h>
Public メソッド | |
const char * | name () const |
const char * | basename () const |
virtual void | print (::std::ostream &os=::std::cout) const |
virtual void | dump (::std::ostream &os=::std::cout) const |
virtual void | trace (sc_trace_file *tf) const |
virtual const char * | kind () const |
sc_simcontext * | simcontext () const |
bool | add_attribute (sc_attr_base &) |
sc_attr_base * | get_attribute (const std::string &name_) |
const sc_attr_base * | get_attribute (const std::string &name_) const |
sc_attr_base * | remove_attribute (const std::string &name_) |
void | remove_all_attributes () |
int | num_attributes () const |
sc_attr_cltn & | attr_cltn () |
const sc_attr_cltn & | attr_cltn () const |
virtual const std::vector < sc_object * > & | get_child_objects () const |
sc_object * | get_parent () const |
sc_object * | get_parent_object () const |
Protected メソッド | |
sc_object () | |
sc_object (const char *nm) | |
virtual | ~sc_object () |
Private メソッド | |
void | sc_object_init (const char *nm) |
Private 変数 | |
sc_simcontext * | m_simc |
char * | m_name |
sc_attr_cltn * | m_attr_cltn_p |
sc_object * | m_parent |
フレンド | |
class | sc_object_manager |
class | sc_module_dynalloc_list |
class | sc_process_b |
sc_object.h の 71 行で定義されています。
sc_core::sc_object::sc_object | ( | ) | [protected] |
sc_object.cpp の 227 行で定義されています。
00227 : m_parent(0) 00228 { 00229 sc_object_init( sc_gen_unique_name("object") ); 00230 }
sc_core::sc_object::sc_object | ( | const char * | nm | ) | [protected] |
sc_object.cpp の 238 行で定義されています。
00238 : m_parent(0) 00239 { 00240 int namebuf_alloc = 0; 00241 char* namebuf = 0; 00242 const char* p; 00243 00244 // null name or "" uses machine generated name. 00245 if ( !nm || strlen(nm) == 0 ) 00246 nm = sc_gen_unique_name("object"); 00247 p = nm; 00248 00249 if (nm && sc_enable_name_checking) { 00250 namebuf_alloc = 1 + strlen(nm); 00251 namebuf = (char*) sc_mempool::allocate(namebuf_alloc); 00252 char* q = namebuf; 00253 const char* r = nm; 00254 bool has_illegal_char = false; 00255 while (*r) { 00256 if (object_name_illegal_char(*r)) { 00257 has_illegal_char = true; 00258 *q = '_'; 00259 } else { 00260 *q = *r; 00261 } 00262 r++; 00263 q++; 00264 } 00265 *q = '\0'; 00266 p = namebuf; 00267 if (has_illegal_char) 00268 { 00269 std::string message = nm; 00270 message += " substituted by "; 00271 message += namebuf; 00272 SC_REPORT_WARNING( SC_ID_ILLEGAL_CHARACTERS_, message.c_str()); 00273 } 00274 } 00275 sc_object_init(p); 00276 sc_mempool::release( namebuf, namebuf_alloc ); 00277 }
sc_core::sc_object::~sc_object | ( | ) | [protected, virtual] |
sc_object.cpp の 279 行で定義されています。
00280 { 00281 if (m_name[-1] && m_simc) { 00282 sc_object_manager* object_manager = m_simc->get_object_manager(); 00283 object_manager->remove_object(m_name); 00284 00285 sc_module* parent_mod = DCAST<sc_module*>(m_parent); 00286 if (parent_mod) { 00287 parent_mod->remove_child_object( this ); 00288 } else { 00289 sc_process_b* parent_proc = DCAST<sc_process_b*>(m_parent); 00290 if (parent_proc) { 00291 parent_proc->remove_child_object( this ); 00292 } else { 00293 m_simc->remove_child_object( this ); 00294 } 00295 } 00296 } 00297 delete [] (m_name-1); 00298 if ( m_attr_cltn_p ) delete m_attr_cltn_p; 00299 }
const char* sc_core::sc_object::name | ( | ) | const [inline] |
const char * sc_core::sc_object::basename | ( | ) | const |
sc_object.cpp の 95 行で定義されています。
00096 { 00097 const char* p = strrchr( m_name, SC_HIERARCHY_CHAR ); 00098 return p ? (p + 1) : m_name; 00099 }
void sc_core::sc_object::print | ( | ::std::ostream & | os = ::std::cout |
) | const [virtual] |
sc_core::sc_fifo< T >, sc_core::sc_signal< T >, sc_core::sc_signal< bool >, sc_core::sc_signal< sc_dt::sc_logic >, と sc_core::sc_signal< sc_dt::sc_lv< W > >で再定義されています。
sc_object.cpp の 102 行で定義されています。
00103 { 00104 os << name(); 00105 }
void sc_core::sc_object::dump | ( | ::std::ostream & | os = ::std::cout |
) | const [virtual] |
void sc_core::sc_object::trace | ( | sc_trace_file * | tf | ) | const [virtual] |
virtual const char* sc_core::sc_object::kind | ( | ) | const [inline, virtual] |
sc_core::sc_buffer< T >, sc_core::sc_clock, sc_core::sc_event_queue, sc_core::sc_export< IF >, sc_core::sc_fifo< T >, sc_core::sc_fifo_in< T >, sc_core::sc_fifo_out< T >, sc_core::sc_mutex, sc_core::sc_port_base, sc_core::sc_port< IF, N, P >, sc_core::sc_prim_channel, sc_core::sc_semaphore, sc_core::sc_signal< T >, sc_core::sc_signal< bool >, sc_core::sc_signal< sc_dt::sc_logic >, sc_core::sc_in< T >, sc_core::sc_in< bool >, sc_core::sc_in< sc_dt::sc_logic >, sc_core::sc_inout< T >, sc_core::sc_inout< bool >, sc_core::sc_inout< sc_dt::sc_logic >, sc_core::sc_out< T >, sc_core::sc_signal_resolved, sc_core::sc_in_resolved, sc_core::sc_inout_resolved, sc_core::sc_out_resolved, sc_core::sc_signal_rv< W >, sc_core::sc_in_rv< W >, sc_core::sc_inout_rv< W >, sc_core::sc_out_rv< W >, sc_core::sc_cthread_process, sc_core::sc_method_process, sc_core::sc_module, sc_core::sc_thread_process, sc_core::sc_port< sc_core::sc_signal_inout_if< bool >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_inout_if< sc_dt::sc_logic >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_in_if< bool >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_in_if< sc_dt::sc_logic >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_inout_if< T >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_in_if< T >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_in_if< sc_dt::sc_lv< W > >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_fifo_out_if< T >, 0, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_signal_inout_if< sc_dt::sc_lv< W > >, 1, SC_ONE_OR_MORE_BOUND >, sc_core::sc_port< sc_core::sc_fifo_in_if< T >, 0, SC_ONE_OR_MORE_BOUND >, sc_core::sc_signal< sc_dt::sc_lv< W > >, sc_core::sc_in< sc_dt::sc_lv< W > >, と sc_core::sc_inout< sc_dt::sc_lv< W > >で再定義されています。
sc_object.h の 90 行で定義されています。
sc_simcontext* sc_core::sc_object::simcontext | ( | ) | const [inline] |
bool sc_core::sc_object::add_attribute | ( | sc_attr_base & | attribute_ | ) |
sc_object.cpp の 311 行で定義されています。
00312 { 00313 if ( !m_attr_cltn_p ) m_attr_cltn_p = new sc_attr_cltn; 00314 return ( m_attr_cltn_p->push_back( &attribute_ ) ); 00315 }
sc_attr_base * sc_core::sc_object::get_attribute | ( | const std::string & | name_ | ) |
sc_object.cpp の 321 行で定義されています。
00322 { 00323 if ( !m_attr_cltn_p ) m_attr_cltn_p = new sc_attr_cltn; 00324 return ( (*m_attr_cltn_p)[name_] ); 00325 }
const sc_attr_base * sc_core::sc_object::get_attribute | ( | const std::string & | name_ | ) | const |
sc_object.cpp の 328 行で定義されています。
00329 { 00330 if ( !m_attr_cltn_p ) m_attr_cltn_p = new sc_attr_cltn; 00331 return ( (*m_attr_cltn_p)[name_] ); 00332 }
sc_attr_base * sc_core::sc_object::remove_attribute | ( | const std::string & | name_ | ) |
sc_object.cpp の 338 行で定義されています。
00339 { 00340 if ( m_attr_cltn_p ) 00341 return ( m_attr_cltn_p->remove( name_ ) ); 00342 else 00343 return 0; 00344 }
void sc_core::sc_object::remove_all_attributes | ( | ) |
sc_object.cpp の 350 行で定義されています。
00351 { 00352 if ( m_attr_cltn_p ) 00353 m_attr_cltn_p->remove_all(); 00354 }
int sc_core::sc_object::num_attributes | ( | ) | const |
sc_object.cpp の 360 行で定義されています。
00361 { 00362 if ( m_attr_cltn_p ) 00363 return ( m_attr_cltn_p->size() ); 00364 else 00365 return 0; 00366 }
sc_attr_cltn & sc_core::sc_object::attr_cltn | ( | ) |
sc_object.cpp の 372 行で定義されています。
00373 { 00374 if ( !m_attr_cltn_p ) m_attr_cltn_p = new sc_attr_cltn; 00375 return *m_attr_cltn_p; 00376 }
const sc_attr_cltn & sc_core::sc_object::attr_cltn | ( | ) | const |
sc_object.cpp の 379 行で定義されています。
00380 { 00381 if ( !m_attr_cltn_p ) m_attr_cltn_p = new sc_attr_cltn; 00382 return *m_attr_cltn_p; 00383 }
virtual const std::vector<sc_object*>& sc_core::sc_object::get_child_objects | ( | ) | const [inline, virtual] |
sc_object* sc_core::sc_object::get_parent | ( | ) | const [inline] |
sc_object* sc_core::sc_object::get_parent_object | ( | ) | const [inline] |
void sc_core::sc_object::sc_object_init | ( | const char * | nm | ) | [private] |
sc_object.cpp の 125 行で定義されています。
00126 { 00127 bool clash; // True if path name exists in obj table 00128 const char* leafname_p; // Leaf name (this object) 00129 char pathname[BUFSIZ]; // Path name 00130 char pathname_orig[BUFSIZ]; // Original path name which may clash 00131 const char* parentname_p; // Parent path name 00132 bool put_in_table; // True if should put in object table 00133 00134 // SET UP POINTERS TO OBJECT MANAGER, PARENT, AND SIMULATION CONTEXT: 00135 // 00136 // Make the current simcontext the simcontext for this object 00137 00138 m_simc = sc_get_curr_simcontext(); 00139 m_attr_cltn_p = 0; 00140 sc_object_manager* object_manager = m_simc->get_object_manager(); 00141 sc_object* parent_p = object_manager->hierarchy_curr(); 00142 if (!parent_p) { 00143 sc_object* proc = (sc_object*)sc_get_current_process_b(); 00144 parent_p = proc; 00145 } 00146 m_parent = parent_p; 00147 00148 00149 // CONSTRUCT PATHNAME TO OBJECT BEING CREATED: 00150 // 00151 // If there is not a leaf name generate one. 00152 00153 parentname_p = parent_p ? parent_p->name() : ""; 00154 if (nm && nm[0] ) 00155 { 00156 leafname_p = nm; 00157 put_in_table = true; 00158 } 00159 else 00160 { 00161 leafname_p = sc_object_newname(pathname_orig); 00162 put_in_table = false; 00163 } 00164 if (parent_p) { 00165 std::sprintf(pathname, "%s%c%s", parentname_p, 00166 SC_HIERARCHY_CHAR, leafname_p 00167 ); 00168 } else { 00169 strcpy(pathname, leafname_p); 00170 } 00171 00172 // SAVE the original path name 00173 // 00174 strcpy(pathname_orig, pathname); 00175 00176 // MAKE SURE THE OBJECT NAME IS UNIQUE 00177 // 00178 // If not use unique name generator to make it unique. 00179 00180 clash = false; 00181 while (object_manager->find_object(pathname)) { 00182 clash = true; 00183 leafname_p = sc_gen_unique_name(leafname_p); 00184 if (parent_p) { 00185 std::sprintf(pathname, "%s%c%s", parentname_p, 00186 SC_HIERARCHY_CHAR, leafname_p 00187 ); 00188 } else { 00189 strcpy(pathname, leafname_p); 00190 } 00191 } 00192 if (clash) { 00193 std::string message = pathname_orig; 00194 message += ". Latter declaration will be renamed to "; 00195 message += pathname; 00196 SC_REPORT_WARNING( SC_ID_OBJECT_EXISTS_, message.c_str()); 00197 } 00198 00199 00200 // MOVE OBJECT NAME TO PERMANENT STORAGE 00201 // 00202 // Note here we pull a little trick -- use the first byte to store 00203 // information about whether to put the object in the object table in the 00204 // object manager 00205 00206 char* ptr = new char[strlen( pathname ) + 2]; 00207 ptr[0] = put_in_table; 00208 m_name = ptr + 1; 00209 strcpy(m_name, pathname); 00210 00211 if (put_in_table) { 00212 object_manager->insert_object(m_name, this); 00213 sc_module* curr_module = m_simc->hierarchy_curr(); 00214 if( curr_module != 0 ) { 00215 curr_module->add_child_object( this ); 00216 } else { 00217 sc_process_b* curr_proc = sc_get_current_process_b(); 00218 if (curr_proc) { 00219 curr_proc->add_child_object( this ); 00220 } else { 00221 m_simc->add_child_object( this ); 00222 } 00223 } 00224 } 00225 }
friend class sc_object_manager [friend] |
sc_object.h の 73 行で定義されています。
friend class sc_module_dynalloc_list [friend] |
sc_object.h の 74 行で定義されています。
friend class sc_process_b [friend] |
sc_simcontext* sc_core::sc_object::m_simc [private] |
sc_object.h の 134 行で定義されています。
char* sc_core::sc_object::m_name [private] |
sc_object.h の 135 行で定義されています。
sc_attr_cltn* sc_core::sc_object::m_attr_cltn_p [mutable, private] |
sc_object.h の 136 行で定義されています。
sc_object* sc_core::sc_object::m_parent [private] |
sc_object.h の 137 行で定義されています。