mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
Ignore privacy
Removed the requirement of passing flags throughout ICG indicating if we are in an inherited class or not. Removed the init_attr friends throughout Trick core headers.
This commit is contained in:
parent
34090169fb
commit
314e962edf
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for ABM_Integrator
|
||||
*/
|
||||
class ABM_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__ABM_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::ABM4IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class ABM_Integrator :
|
||||
protected ABM_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__ABM_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -126,10 +126,10 @@ GROUP "/" {
|
||||
protected:
|
||||
|
||||
#ifdef HDF5
|
||||
std::vector<HDF5_INFO *> parameters;
|
||||
std::vector<HDF5_INFO *> parameters; // trick_io(**)
|
||||
|
||||
hid_t file;
|
||||
hid_t root_group, header_group;
|
||||
hid_t file; // trick_io(**)
|
||||
hid_t root_group, header_group; // trick_io(**)
|
||||
#endif
|
||||
|
||||
} ;
|
||||
|
@ -37,8 +37,8 @@ namespace Trick {
|
||||
virtual void * thread_body() ;
|
||||
virtual void dump( std::ostream & oss = std::cout ) ;
|
||||
protected:
|
||||
Trick::DRDMutexes & drd_mutexes ;
|
||||
std::vector <Trick::DataRecordGroup *> & groups ;
|
||||
Trick::DRDMutexes & drd_mutexes ; // trick_io(**)
|
||||
std::vector <Trick::DataRecordGroup *> & groups ; // trick_io(**)
|
||||
|
||||
private:
|
||||
void operator =(const Trick::DRDWriterThread &) ;
|
||||
@ -115,7 +115,7 @@ namespace Trick {
|
||||
std::vector <Trick::DataRecordGroup *> groups ; /* trick_io(**) trick_units(--) */
|
||||
|
||||
/** mutexes shared with writer thread */
|
||||
DRDMutexes drd_mutexes ;
|
||||
DRDMutexes drd_mutexes ; // trick_io(**)
|
||||
|
||||
|
||||
private:
|
||||
|
@ -25,11 +25,6 @@ namespace Trick {
|
||||
* Helper class for Euler_Cromer_Integrator
|
||||
*/
|
||||
class Euler_Cromer_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__Euler_Cromer_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::SymplecticEulerIntegratorConstructor
|
||||
@ -44,10 +39,6 @@ protected:
|
||||
class Euler_Cromer_Integrator :
|
||||
protected Euler_Cromer_IntegratorHelper,
|
||||
public er7_utils::TrickSecondOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__Euler_Cromer_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for Euler_Integrator
|
||||
*/
|
||||
class Euler_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__Euler_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::EulerIntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class Euler_Integrator :
|
||||
protected Euler_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__Euler_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -25,8 +25,6 @@ enum EventBeforeAfter {
|
||||
*/
|
||||
class Event {
|
||||
|
||||
TRICK_MM_FRIENDS(Trick__Event)
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -34,8 +34,6 @@ namespace Trick {
|
||||
|
||||
class EventManager {
|
||||
|
||||
TRICK_MM_FRIENDS(Trick__EventManager)
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -72,15 +72,15 @@ namespace Trick {
|
||||
|
||||
private:
|
||||
|
||||
Trick::JobData * process_event_job ;
|
||||
Trick::JobData * process_event_job ; // trick_io(**)
|
||||
|
||||
/** Use an ordered set to store the events. The events are sorted by their next execution
|
||||
time. The set allows us to add/remove items at any time.\n */
|
||||
std::multiset< Trick::Event *, CompareEventPtrs > event_set ;
|
||||
std::multiset< Trick::Event *, CompareEventPtrs > event_set ; // trick_io(**)
|
||||
|
||||
/** Added events are put in the staging area called pending events. The add_pending_events
|
||||
job moves pending events to the event_set.\n */
|
||||
std::vector< Trick::Event * > pending_events ;
|
||||
std::vector< Trick::Event * > pending_events ; // trick_io(**)
|
||||
|
||||
} ;
|
||||
|
||||
|
@ -43,11 +43,6 @@ namespace Trick {
|
||||
|
||||
class Executive : public Trick::Scheduler {
|
||||
|
||||
friend class InputProcessor ;
|
||||
#ifndef SWIG
|
||||
friend void init_attrTrick__Executive() ;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
/** Attempts to attach a debugger in the event a signal shuts down the simulation.\n */
|
||||
bool attach_debugger; /**< trick_units(--) */
|
||||
|
@ -56,7 +56,7 @@ namespace Trick {
|
||||
|
||||
protected:
|
||||
#ifdef __linux
|
||||
clockid_t clk_id ;
|
||||
clockid_t clk_id ; // trick_io(**)
|
||||
#endif
|
||||
} ;
|
||||
|
||||
|
@ -36,8 +36,7 @@ namespace Trick {
|
||||
/** Returned value from event condition evaluation.\n */
|
||||
int return_val ; /**< trick_io(**) trick_units(--) */
|
||||
|
||||
/** Input processor mutex for protection for var server and event processing.\n */
|
||||
pthread_mutex_t ip_mutex; /**< trick_io(**) trick_units(--) */
|
||||
/** Input processor mutex for protection for var server and event processing.\n */ pthread_mutex_t ip_mutex; /**< trick_io(**) trick_units(--) */
|
||||
|
||||
/**
|
||||
@brief Constructor.
|
||||
|
@ -72,8 +72,6 @@ namespace Trick {
|
||||
|
||||
class IPPythonEvent : public Trick::Event {
|
||||
|
||||
TRICK_MM_FRIENDS(Trick__IPPythonEvent)
|
||||
|
||||
public:
|
||||
|
||||
/** True when event is in the event_list to be processed; false when it is to be removed from event_list.\n */
|
||||
|
@ -27,8 +27,6 @@ namespace Trick {
|
||||
*/
|
||||
class JITEvent : public Trick::Event {
|
||||
|
||||
TRICK_MM_FRIENDS(Trick__JITEvent)
|
||||
|
||||
public:
|
||||
JITEvent() ;
|
||||
|
||||
|
@ -19,9 +19,6 @@ namespace Trick {
|
||||
*/
|
||||
class JSONVariableServer : public Trick::ThreadBase {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrTrick__JSONVariableServer() ;
|
||||
|
||||
public:
|
||||
JSONVariableServer() ;
|
||||
virtual ~JSONVariableServer() ;
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for MM4_Integrator
|
||||
*/
|
||||
class MM4_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__MM4_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::MM4IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class MM4_Integrator :
|
||||
protected MM4_IntegratorHelper,
|
||||
public er7_utils::TrickSecondOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__MM4_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -660,8 +660,8 @@ namespace Trick {
|
||||
static int instance_count; /**< -- Number of instances of MemoryManager. Not allowed to exceed 1.*/
|
||||
const char* local_anon_var_prefix; /**< -- Temporary-variable-name prefix. */
|
||||
const char* extern_anon_var_prefix; /**< -- Temporary-variable-name prefix. */
|
||||
CheckPointAgent* currentCheckPointAgent; /**< -- currently active Check point agent. */
|
||||
CheckPointAgent* defaultCheckPointAgent; /**< -- the classic Check point agent. */
|
||||
CheckPointAgent* currentCheckPointAgent; /**< ** currently active Check point agent. */
|
||||
CheckPointAgent* defaultCheckPointAgent; /**< ** the classic Check point agent. */
|
||||
|
||||
bool reduced_checkpoint; /**< -- true = Don't write zero valued variables in the checkpoint. false= Write all values. */
|
||||
bool hexfloat_checkpoint; /**< -- true = Represent floating point values as hexidecimal to preserve precision. false= Normal. */
|
||||
|
@ -242,11 +242,6 @@ namespace Trick {
|
||||
*/
|
||||
class MonteCarlo : public Trick::Scheduler {
|
||||
|
||||
friend class InputProcessor;
|
||||
#ifndef SWIG
|
||||
friend void init_attrTrick__MonteCarlo();
|
||||
#endif
|
||||
|
||||
public:
|
||||
/** Verbosity of message reporting. */
|
||||
enum Verbosity {
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for NL2_Integrator
|
||||
*/
|
||||
class NL2_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__NL2_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::NystromLear2IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class NL2_Integrator :
|
||||
protected NL2_IntegratorHelper,
|
||||
public er7_utils::TrickSecondOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__NL2_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for RK2_Integrator
|
||||
*/
|
||||
class RK2_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RK2_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::RK2HeunIntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class RK2_Integrator :
|
||||
protected RK2_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RK2_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for RK4_Integrator
|
||||
*/
|
||||
class RK4_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RK4_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::RK4IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class RK4_Integrator :
|
||||
protected RK4_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RK4_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for RKF45_Integrator
|
||||
*/
|
||||
class RKF45_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RKF45_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::RKFehlberg45IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class RKF45_Integrator :
|
||||
protected RKF45_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RKF45_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for RKF78_Integrator
|
||||
*/
|
||||
class RKF78_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RKF78_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::RKFehlberg78IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class RKF78_Integrator :
|
||||
protected RKF78_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RKF78_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace Trick {
|
||||
* Helper class for RKG4_Integrator
|
||||
*/
|
||||
class RKG4_IntegratorHelper {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RKG4_IntegratorHelper();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
er7_utils::RKGill4IntegratorConstructor
|
||||
@ -42,10 +37,6 @@ protected:
|
||||
class RKG4_Integrator :
|
||||
protected RKG4_IntegratorHelper,
|
||||
public er7_utils::TrickFirstOrderOdeIntegrator {
|
||||
#ifndef SWIG
|
||||
friend class InputProcessor;
|
||||
friend void init_attrTrick__RKG4_Integrator();
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -31,9 +31,6 @@ namespace Trick {
|
||||
*/
|
||||
class ThreadBase {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrTrick__ThreadBase() ;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -51,13 +48,6 @@ namespace Trick {
|
||||
*/
|
||||
pthread_t get_pthread_id() ;
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Sets the thread pthread ID.
|
||||
*/
|
||||
void set_pthread_id( pthread_t in_pthread_id ) ;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Gets the thread process ID.
|
||||
*/
|
||||
|
@ -28,9 +28,6 @@ namespace Trick {
|
||||
|
||||
class VariableServer {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrTrick__VariableServer() ;
|
||||
|
||||
public:
|
||||
/**
|
||||
@brief Constructor.
|
||||
|
@ -19,9 +19,6 @@ namespace Trick {
|
||||
*/
|
||||
class VariableServerListenThread : public Trick::ThreadBase {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrTrick__VariableServerListenThread() ;
|
||||
|
||||
public:
|
||||
VariableServerListenThread() ;
|
||||
virtual ~VariableServerListenThread() ;
|
||||
|
@ -24,9 +24,6 @@ namespace Trick {
|
||||
*/
|
||||
class VariableServerThread : public Trick::ThreadBase {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrTrick__VariableServerThread() ;
|
||||
|
||||
public:
|
||||
enum ConnectionType { TCP, UDP, MCAST } ;
|
||||
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "ClassValues.hh"
|
||||
#include "FieldDescription.hh"
|
||||
|
||||
ClassValues::ClassValues(bool in_inherit, bool in_virtual_inherit) :
|
||||
inherited(in_inherit) ,
|
||||
virtual_inherited(in_virtual_inherit) ,
|
||||
ClassValues::ClassValues() :
|
||||
has_init_attr_friend(false) ,
|
||||
is_pod(false) ,
|
||||
is_abstract(false) ,
|
||||
@ -20,19 +18,11 @@ ClassValues::~ClassValues() {
|
||||
for ( fdit = field_descripts.begin() ; fdit != field_descripts.end() ; fdit++ ) {
|
||||
delete (*fdit) ;
|
||||
}
|
||||
|
||||
std::vector<ClassValues *>::iterator cvit ;
|
||||
for ( cvit = inherited_classes.begin() ; cvit != inherited_classes.end() ; cvit++ ) {
|
||||
delete (*cvit) ;
|
||||
}
|
||||
}
|
||||
|
||||
void ClassValues::addFieldDescription(FieldDescription * in_fdes) {
|
||||
field_descripts.push_back(in_fdes) ;
|
||||
|
||||
// This section creates code that clang on the Mac cannot compile.
|
||||
// So, we cannot handle overloaded names on the Mac.
|
||||
#ifndef __APPLE__
|
||||
// Test to see if the new field overloads a field of the same name. If it does
|
||||
// then fully qualify the name of the inherited field (the one already in field_name_to_info).
|
||||
std::map< std::string , FieldDescription * >::iterator mit = field_name_to_info_map.find(in_fdes->getName()) ;
|
||||
@ -44,7 +34,6 @@ void ClassValues::addFieldDescription(FieldDescription * in_fdes) {
|
||||
field_name_to_info_map.erase(mit) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
field_name_to_info_map[in_fdes->getName()] = in_fdes ;
|
||||
}
|
||||
@ -53,14 +42,14 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
||||
// Make a copy of all of the FieldDescription variables.
|
||||
field_descripts.insert(field_descripts.end(), in_fdes.begin() , in_fdes.end()) ;
|
||||
|
||||
// This section creates code that clang on the Mac cannot compile.
|
||||
// So, we cannot handle overloaded names on the Mac.
|
||||
std::vector<FieldDescription *>::iterator fdit ;
|
||||
// Loop through the incoming inherited variable names
|
||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; fdit++ ) {
|
||||
|
||||
(*fdit)->setInherited( true ) ;
|
||||
// Adds the class offset to the field offset giving the total offset to the inherited variable
|
||||
(*fdit)->addOffset( class_offset ) ;
|
||||
#ifndef __APPLE__
|
||||
|
||||
std::string in_name = (*fdit)->getName() ;
|
||||
// search existing names for incoming inherited variable name.
|
||||
std::map< std::string , FieldDescription * >::iterator mit = field_name_to_info_map.find(in_name) ;
|
||||
@ -92,7 +81,6 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
||||
field_name_to_info_map[(*fdit)->getName()] = *fdit ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@ -170,30 +158,14 @@ void ClassValues::clearFieldDescription() {
|
||||
field_descripts.clear() ;
|
||||
}
|
||||
|
||||
void ClassValues::addInheritedClass(ClassValues * in_cv) {
|
||||
inherited_classes.push_back(in_cv) ;
|
||||
void ClassValues::addInheritedClass(std::string class_name) {
|
||||
inherited_classes.push_back(class_name) ;
|
||||
}
|
||||
|
||||
void ClassValues::clearInheritedClass() {
|
||||
inherited_classes.clear() ;
|
||||
}
|
||||
|
||||
void ClassValues::setInherited(bool in_inh) {
|
||||
inherited = in_inh ;
|
||||
}
|
||||
|
||||
bool ClassValues::isInherited() {
|
||||
return inherited ;
|
||||
}
|
||||
|
||||
void ClassValues::setVirtualInherited(bool in_inh) {
|
||||
virtual_inherited = in_inh ;
|
||||
}
|
||||
|
||||
bool ClassValues::isVirtualInherited() {
|
||||
return virtual_inherited ;
|
||||
}
|
||||
|
||||
void ClassValues::setHasInitAttrFriend(bool in_val) {
|
||||
has_init_attr_friend = in_val ;
|
||||
}
|
||||
@ -234,6 +206,20 @@ bool ClassValues::getHasPublicDestructor() {
|
||||
return has_public_destructor ;
|
||||
}
|
||||
|
||||
std::string ClassValues::getFullyQualifiedTypeName() {
|
||||
std::ostringstream oss ;
|
||||
NamespaceIterator ni ;
|
||||
|
||||
for ( ni = namespace_begin() ; ni != namespace_end() ; ni++ ) {
|
||||
oss << (*ni) << "::" ;
|
||||
}
|
||||
for ( ni = container_class_begin() ; ni != container_class_end() ; ni++ ) {
|
||||
oss << (*ni) << "::" ;
|
||||
}
|
||||
oss << name ;
|
||||
return oss.str() ;
|
||||
}
|
||||
|
||||
void ClassValues::setMangledTypeName( std::string in_val ) {
|
||||
mangled_type_name = in_val ;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class FieldDescription ;
|
||||
|
||||
class ClassValues : public ConstructValues {
|
||||
public:
|
||||
ClassValues(bool inherit , bool virtual_inherit) ;
|
||||
ClassValues() ;
|
||||
|
||||
~ClassValues() ;
|
||||
|
||||
@ -48,7 +48,7 @@ class ClassValues : public ConstructValues {
|
||||
FieldIterator field_end() { return field_descripts.end() ; } ;
|
||||
|
||||
/** Appends an inherited class name to the list this class inherits from */
|
||||
void addInheritedClass( ClassValues * in_cv ) ;
|
||||
void addInheritedClass( std::string class_name ) ;
|
||||
|
||||
void saveInheritAncestry( ClassValues * in_cv ) ;
|
||||
void setContainerClassForFields() ;
|
||||
@ -56,13 +56,11 @@ class ClassValues : public ConstructValues {
|
||||
|
||||
void clearInheritedClass() ;
|
||||
|
||||
typedef std::vector< ClassValues * >::iterator InheritedClassesIterator ;
|
||||
typedef std::vector< std::string >::iterator InheritedClassesIterator ;
|
||||
InheritedClassesIterator inherit_classes_begin() { return inherited_classes.begin() ; } ;
|
||||
InheritedClassesIterator inherit_classes_end() { return inherited_classes.end() ; } ;
|
||||
unsigned int getNumInheritedClasses() { return inherited_classes.size() ; } ;
|
||||
|
||||
void setInherited(bool in_inh) ;
|
||||
bool isInherited() ;
|
||||
void setVirtualInherited(bool in_inh) ;
|
||||
bool isVirtualInherited() ;
|
||||
void setHasInitAttrFriend(bool in_val) ;
|
||||
@ -75,9 +73,8 @@ class ClassValues : public ConstructValues {
|
||||
bool getHasDefaultConstructor() ;
|
||||
void setHasPublicDestructor(bool in_val) ;
|
||||
bool getHasPublicDestructor() ;
|
||||
std::string getFullyQualifiedTypeName() ;
|
||||
void setMangledTypeName( std::string in_val ) ;
|
||||
bool getInvadePrivacy() ;
|
||||
void setInvadePrivacy( bool in_val ) ;
|
||||
std::string getMangledTypeName() ;
|
||||
std::string getFullyQualifiedMangledTypeName() ;
|
||||
|
||||
@ -93,17 +90,11 @@ class ClassValues : public ConstructValues {
|
||||
std::set< std::string > field_names_to_qualify ;
|
||||
|
||||
/** List of classes we inherit from */
|
||||
std::vector< ClassValues * > inherited_classes ;
|
||||
std::vector< std::string > inherited_classes ;
|
||||
|
||||
/** Map of all inherited classes. Counts how many times a class is inherited. */
|
||||
std::map< std::string , unsigned int > all_inherited_class_names_map ;
|
||||
|
||||
/** Is this class being processed as an inherited class */
|
||||
bool inherited ;
|
||||
|
||||
/** Is this class being processed as an virtual inherited class */
|
||||
bool virtual_inherited ;
|
||||
|
||||
/** Does this class a "friend class init_attr<class_name>" statement */
|
||||
bool has_init_attr_friend ;
|
||||
|
||||
|
@ -23,14 +23,12 @@ CXXRecordVisitor::CXXRecordVisitor(
|
||||
CommentSaver & in_cs ,
|
||||
HeaderSearchDirs & in_hsd ,
|
||||
PrintAttributes & in_pa ,
|
||||
bool in_inherited ,
|
||||
bool in_virtual_inherited ,
|
||||
bool in_include_virtual_base ) :
|
||||
ci(in_ci) ,
|
||||
cs(in_cs) ,
|
||||
hsd(in_hsd) ,
|
||||
pa(in_pa) ,
|
||||
cval(in_inherited , in_virtual_inherited) ,
|
||||
cval() ,
|
||||
include_virtual_base(in_include_virtual_base) {}
|
||||
|
||||
CXXRecordVisitor::~CXXRecordVisitor() {
|
||||
@ -57,7 +55,7 @@ bool CXXRecordVisitor::TraverseDecl(clang::Decl *d) {
|
||||
clang::RecordDecl * rd = crd->getDefinition() ;
|
||||
if ( rd != NULL and rd->getAccess() == clang::AS_public ) {
|
||||
if ( isInUserCode(ci , crd->getRBraceLoc(), hsd) ) {
|
||||
CXXRecordVisitor embedded_cvis(ci , cs, hsd , pa, false, false, true) ;
|
||||
CXXRecordVisitor embedded_cvis(ci , cs, hsd , pa, true) ;
|
||||
embedded_cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(d)) ;
|
||||
pa.printClass(embedded_cvis.get_class_data()) ;
|
||||
}
|
||||
@ -70,14 +68,12 @@ bool CXXRecordVisitor::TraverseDecl(clang::Decl *d) {
|
||||
if ( ed->getAccess() == clang::AS_public ) {
|
||||
EnumVisitor evis(ci, hsd) ;
|
||||
evis.TraverseDecl(ed) ;
|
||||
//if ( evis.get_enum_data() != NULL ) {
|
||||
pa.printEnum(evis.get_enum_data()) ;
|
||||
//}
|
||||
pa.printEnum(evis.get_enum_data()) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case clang::Decl::Field : {
|
||||
FieldVisitor fvis(ci , hsd , cs, pa, cval.getName() , cval.isInherited() ) ;
|
||||
FieldVisitor fvis(ci , hsd , cs, pa, cval.getName()) ;
|
||||
fvis.TraverseFieldDecl(static_cast<clang::FieldDecl *>(d)) ;
|
||||
cval.addFieldDescription(fvis.get_field_data()) ;
|
||||
}
|
||||
@ -88,13 +84,11 @@ bool CXXRecordVisitor::TraverseDecl(clang::Decl *d) {
|
||||
break ;
|
||||
case clang::Decl::Var : {
|
||||
/* Static fields appear as vars. Treat it as a field. */
|
||||
FieldVisitor fvis(ci , hsd , cs, pa, cval.getName() , cval.isInherited() ) ;
|
||||
FieldVisitor fvis(ci , hsd , cs, pa, cval.getName()) ;
|
||||
fvis.TraverseVarDecl(static_cast<clang::VarDecl *>(d)) ;
|
||||
cval.addFieldDescription(fvis.get_field_data()) ;
|
||||
}
|
||||
break ;
|
||||
case clang::Decl::AccessSpec :
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
@ -192,7 +186,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
inherit_class_offset = record_layout.getBaseClassOffset(llvm::cast<clang::CXXRecordDecl>(rd)).getQuantity() ;
|
||||
//std::cout << " [34minherit_class_offset = " << inherit_class_offset << "[00m" << std::endl ;
|
||||
//std::cout << " [34m" << getFileName(ci , rd->getRBraceLoc(), hsd) << "[00m" << std::endl ;
|
||||
CXXRecordVisitor inherit_cvis(ci , cs, hsd , pa, true, bcii->isVirtual(), false) ;
|
||||
CXXRecordVisitor inherit_cvis(ci , cs, hsd , pa, false) ;
|
||||
inherit_cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(rd)) ;
|
||||
cval.addInheritedFieldDescriptions(inherit_cvis.get_class_data()->getFieldDescription(), inherit_class_offset) ;
|
||||
// clear the field list in the inherited class so they are not freed when inherit_cvis goes out of scope.
|
||||
@ -209,7 +203,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
icv->clearInheritedClass() ;
|
||||
|
||||
// Save the copy of the inherited class to the current class
|
||||
cval.addInheritedClass(icv) ;
|
||||
cval.addInheritedClass(inherit_cvis.get_class_data()->getFullyQualifiedTypeName()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,7 +211,9 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
}
|
||||
//std::cout << " [34mend inheritance[00m" << std::endl ;
|
||||
|
||||
/* Virtual base classes are parsed once at the top. Each inherited class call to CXXRecordVisitor sets this flag to false. */
|
||||
// Virtual base classes are parsed once
|
||||
// When processing inherited classes include_virtual_base will be set to true
|
||||
// so we don't process virtual inherited classes multiple times.
|
||||
if ( include_virtual_base ) {
|
||||
for ( bcii = rec->vbases_begin() ; bcii != rec->vbases_end() ; bcii++ ) {
|
||||
const clang::Type * temp = bcii->getType().getTypePtr() ;
|
||||
@ -225,19 +221,20 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
const clang::RecordType * rt = temp->getAs<clang::RecordType>() ;
|
||||
if ( rt != NULL ) {
|
||||
clang::RecordDecl * rd = rt->getDecl() ;
|
||||
//std::cout << " [34m" << cval.getName() << " virtually inherits from " << rd->getNameAsString() << "[00m" << std::endl ;
|
||||
//std::cout << " [34m" << cval.getName() << " virtually inherits from "
|
||||
// << rd->getNameAsString() << "[00m" << std::endl ;
|
||||
//rd->dump() ; std::cout << std::endl ;
|
||||
if ( isInUserOrTrickCode(ci , rd->getRBraceLoc(), hsd) ) {
|
||||
const clang::ASTRecordLayout &record_layout = rec->getASTContext().getASTRecordLayout(rec);
|
||||
unsigned int inherit_class_offset ;
|
||||
|
||||
// Virtual base classes have a fixed offset that cannot be accessed at runtime. We have clang's calculation
|
||||
// to where the base class will be here. Hopefully it matches what other compilers calculate. :(
|
||||
// to where the base class will be.
|
||||
inherit_class_offset = record_layout.getVBaseClassOffset(llvm::cast<clang::CXXRecordDecl>(rd)).getQuantity() ;
|
||||
|
||||
//std::cout << " [34minherit_class_offset = " << inherit_class_offset << "[00m" << std::endl ;
|
||||
//std::cout << " [34m" << getFileName(ci , rd->getRBraceLoc(), hsd) << "[00m" << std::endl ;
|
||||
CXXRecordVisitor inherit_cvis(ci , cs, hsd , pa, true, bcii->isVirtual(), false) ;
|
||||
CXXRecordVisitor inherit_cvis(ci , cs, hsd , pa, false) ;
|
||||
inherit_cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(rd)) ;
|
||||
cval.addInheritedFieldDescriptions(inherit_cvis.get_class_data()->getFieldDescription(), inherit_class_offset) ;
|
||||
// clear the field list in the inherited class so they are not freed when inherit_cvis goes out of scope.
|
||||
@ -251,7 +248,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
icv->clearInheritedClass() ;
|
||||
|
||||
// Save the copy of the inherited class to the current class
|
||||
cval.addInheritedClass(icv) ;
|
||||
cval.addInheritedClass(inherit_cvis.get_class_data()->getFullyQualifiedTypeName()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,6 +266,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Test if we have a friend with the name "init_attr<class_name>"
|
||||
bool CXXRecordVisitor::VisitFriendDecl( clang::FriendDecl *fd ) {
|
||||
//std::cout << " [33mClassVisitor::VisitFriendDecl[00m" << std::endl ;
|
||||
clang::TypeSourceInfo * tsi = fd->getFriendType() ;
|
||||
|
@ -38,8 +38,6 @@ class CXXRecordVisitor : public clang::RecursiveASTVisitor<CXXRecordVisitor> {
|
||||
CommentSaver & in_cs ,
|
||||
HeaderSearchDirs & in_hsd ,
|
||||
PrintAttributes & in_pa ,
|
||||
bool in_inherited ,
|
||||
bool in_virtual_inherited ,
|
||||
bool in_include_virtual_base ) ;
|
||||
|
||||
~CXXRecordVisitor() ;
|
||||
|
@ -15,12 +15,11 @@
|
||||
#include "trick/units_conv.h"
|
||||
|
||||
FieldDescription::FieldDescription(
|
||||
std::string in_container_class ,
|
||||
bool in_inherited ) :
|
||||
std::string in_container_class ) :
|
||||
container_class(in_container_class) ,
|
||||
field_offset(0) ,
|
||||
field_width(0) ,
|
||||
inherited(in_inherited) ,
|
||||
inherited(false) ,
|
||||
units("--") ,
|
||||
line_no(0) ,
|
||||
io(3) ,
|
||||
@ -316,6 +315,10 @@ std::string FieldDescription::getDescription() {
|
||||
return description ;
|
||||
}
|
||||
|
||||
void FieldDescription::setInherited(bool in_inherited) {
|
||||
inherited = in_inherited ;
|
||||
}
|
||||
|
||||
bool FieldDescription::isInherited() {
|
||||
return inherited ;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class FieldDescription : public ConstructValues {
|
||||
public:
|
||||
|
||||
/* Default the inheritance to false */
|
||||
FieldDescription( std::string in_container_class , bool inherited ) ;
|
||||
FieldDescription( std::string in_container_class ) ;
|
||||
|
||||
/* Extracts units and io code from a comment */
|
||||
void parseComment(std::string) ;
|
||||
@ -75,6 +75,7 @@ class FieldDescription : public ConstructValues {
|
||||
bool hasSTLClear() ;
|
||||
void setStatic( bool yes_no ) ;
|
||||
bool isStatic() ;
|
||||
void setInherited( bool yes_no ) ;
|
||||
bool isInherited() ;
|
||||
void setAccess( clang::AccessSpecifier in_val ) ;
|
||||
clang::AccessSpecifier getAccess() ;
|
||||
|
@ -21,13 +21,12 @@ FieldVisitor::FieldVisitor(clang::CompilerInstance & in_ci ,
|
||||
HeaderSearchDirs & in_hsd ,
|
||||
CommentSaver & in_cs ,
|
||||
PrintAttributes & in_pa ,
|
||||
std::string container_class ,
|
||||
bool in_inherited ) :
|
||||
std::string container_class ) :
|
||||
ci(in_ci) ,
|
||||
hsd(in_hsd) ,
|
||||
cs(in_cs) ,
|
||||
pa(in_pa) {
|
||||
fdes = new FieldDescription(container_class, in_inherited ) ;
|
||||
fdes = new FieldDescription(container_class) ;
|
||||
}
|
||||
|
||||
bool FieldVisitor::VisitDecl(clang::Decl *d) {
|
||||
@ -273,7 +272,7 @@ bool FieldVisitor::ProcessTemplate(std::string in_name , clang::CXXRecordDecl *
|
||||
fdes->getName() + "_" + mangled_name ;
|
||||
|
||||
// Traverse the template declaration
|
||||
CXXRecordVisitor template_spec_cvis(ci , cs, hsd , pa, false, false, true) ;
|
||||
CXXRecordVisitor template_spec_cvis(ci , cs, hsd , pa, true) ;
|
||||
template_spec_cvis.get_class_data()->setMangledTypeName(processed_templates[in_name]) ;
|
||||
template_spec_cvis.TraverseCXXRecordDecl(crd) ;
|
||||
|
||||
|
@ -31,8 +31,7 @@ class FieldVisitor : public clang::RecursiveASTVisitor<FieldVisitor> {
|
||||
HeaderSearchDirs & in_hsd ,
|
||||
CommentSaver & cs ,
|
||||
PrintAttributes & in_pa ,
|
||||
std::string container_class ,
|
||||
bool inherited ) ;
|
||||
std::string container_class ) ;
|
||||
|
||||
/* VisitDecl and VisitType are here for debug printing. */
|
||||
bool VisitDecl(clang::Decl *d) ;
|
||||
|
@ -124,7 +124,7 @@ void PrintFileContents10::print_class_attr(std::ofstream & outfile , ClassValues
|
||||
}
|
||||
}
|
||||
// Print an empty sentinel attribute at the end of the class.
|
||||
FieldDescription * new_fdes = new FieldDescription(std::string(""), false) ;
|
||||
FieldDescription * new_fdes = new FieldDescription(std::string("")) ;
|
||||
print_field_attr(outfile, new_fdes) ;
|
||||
outfile << " };" << std::endl ;
|
||||
delete new_fdes ;
|
||||
@ -137,7 +137,7 @@ void PrintFileContents10::print_field_init_attr_stmts( std::ofstream & outfile ,
|
||||
|
||||
// Static bitfields do not get to this point, they are filtered out in determinePrintAttr
|
||||
|
||||
// Always print offset of a static variable
|
||||
// Always print offset as address of the static variable
|
||||
if ( fdes->isStatic() ) {
|
||||
// print a special offsetof statement if this is a static
|
||||
outfile << " attr" ;
|
||||
@ -149,8 +149,9 @@ void PrintFileContents10::print_field_init_attr_stmts( std::ofstream & outfile ,
|
||||
outfile << cv->getName() << "::" << fdes->getName() << " ;\n" ;
|
||||
}
|
||||
|
||||
// if this is a bitfield...
|
||||
// TODO: may not need to write out offset...
|
||||
if ( fdes->isBitField() ) {
|
||||
// else if this is a bitfield
|
||||
outfile << " attr" ;
|
||||
printNamespaces( outfile, cv , "__" ) ;
|
||||
printContainerClasses( outfile, cv , "__" ) ;
|
||||
@ -163,35 +164,6 @@ void PrintFileContents10::print_field_init_attr_stmts( std::ofstream & outfile ,
|
||||
printContainerClasses( outfile, cv , "__" ) ;
|
||||
outfile << cv->getMangledTypeName() << "[i].size = sizeof(unsigned int) ;\n" ;
|
||||
}
|
||||
#if 0
|
||||
} else if ( fdes->isVirtualInherited() ) {
|
||||
// else if we have a virtually inherited class.
|
||||
outfile << " attr" ;
|
||||
printNamespaces( outfile, cv , "__" ) ;
|
||||
printContainerClasses( outfile, cv , "__" ) ;
|
||||
outfile << cv->getMangledTypeName() << "[i].offset = " << fdes->getBaseClassOffset() ;
|
||||
outfile << " + offsetof(" ;
|
||||
//printNamespaces( cv , "::" ) ;
|
||||
//printContainerClasses( cv , "::" ) ;
|
||||
outfile << fdes->getContainerClass() << "," << fdes->getName() << ") ;\n" ;
|
||||
} else if ( cv->getMangledTypeName() != cv->getName() ) {
|
||||
// else if we have a template type where mangled_type_name is different then name.
|
||||
outfile << " attr" ;
|
||||
printNamespaces( outfile, cv , "__" ) ;
|
||||
printContainerClasses( outfile, cv , "__" ) ;
|
||||
outfile << cv->getMangledTypeName() << "[i].offset = offsetof(" ;
|
||||
outfile << cv->getMangledTypeName() << "," << fdes->getName() << ") ;\n" ;
|
||||
} else {
|
||||
// else print an offsetof statement if this is not a special case
|
||||
outfile << " attr" ;
|
||||
printNamespaces( outfile, cv , "__" ) ;
|
||||
printContainerClasses( outfile, cv , "__" ) ;
|
||||
outfile << cv->getMangledTypeName() << "[i].offset = offsetof(" ;
|
||||
printNamespaces( outfile, cv , "::" ) ;
|
||||
printContainerClasses( outfile, cv , "::" ) ;
|
||||
outfile << cv->getMangledTypeName() << "," << fdes->getName() << ") ;\n" ;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !fdes->isRecord() and !fdes->isEnum() and !fdes->isBitField() and !fdes->isSTL()) {
|
||||
outfile << " attr" ;
|
||||
@ -264,10 +236,7 @@ void PrintFileContents10::print_inherited_add_attr_info( std::ofstream & outfile
|
||||
outfile << "\n ATTRIBUTES temp_attr ;\n\n" ;
|
||||
}
|
||||
for ( cit = cv->inherit_classes_begin() ; cit != cv->inherit_classes_end() ; cit++ ) {
|
||||
outfile << " next_attr = \"" ;
|
||||
printNamespaces( outfile, *cit , "::" ) ;
|
||||
printContainerClasses( outfile, *cit , "::" ) ;
|
||||
outfile << (*cit)->getName() << "\" ;\n" ;
|
||||
outfile << " next_attr = \"" << *cit << "\" ;\n" ;
|
||||
outfile << " mm->add_attr_info( next_attr , &temp_attr , __FILE__ , __LINE__ ) ;\n" ;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ bool TranslationUnitVisitor::TraverseDecl(clang::Decl *d) {
|
||||
if ( rd != NULL and ! getFileName(ci , crd->getRBraceLoc(), hsd).empty() ) {
|
||||
//crd->dump() ; std::cout << std::endl ;
|
||||
if ( isInUserCode(ci , crd->getRBraceLoc(), hsd) ) {
|
||||
CXXRecordVisitor cvis(ci , cs, hsd , pa, false, false, true) ;
|
||||
CXXRecordVisitor cvis(ci , cs, hsd , pa, true) ;
|
||||
|
||||
cvis.TraverseCXXRecordDecl(static_cast<clang::CXXRecordDecl *>(d)) ;
|
||||
pa.printClass(cvis.get_class_data()) ;
|
||||
|
@ -70,7 +70,7 @@ bool TypedefVisitor::VisitRecordType(clang::RecordType *rt) {
|
||||
}
|
||||
|
||||
if ( rd != NULL and ! has_dims ) {
|
||||
CXXRecordVisitor cvis(ci, cs, hsd, pa, false, false, true) ;
|
||||
CXXRecordVisitor cvis(ci, cs, hsd, pa, true) ;
|
||||
cvis.TraverseCXXRecordDecl(clang::cast<clang::CXXRecordDecl>(rd)) ;
|
||||
/* Test to see if the typedef name and the struct/union have the same name.
|
||||
If they do, we won't add the typedeffed record */
|
||||
@ -104,7 +104,7 @@ bool TypedefVisitor::VisitTemplateSpecializationType(clang::TemplateSpecializati
|
||||
if ( debug_level >=2 ) {
|
||||
td->dump() ; std::cout << std::endl ;
|
||||
}
|
||||
CXXRecordVisitor cvis(ci, cs, hsd, pa, false, false, true) ;
|
||||
CXXRecordVisitor cvis(ci, cs, hsd, pa, true) ;
|
||||
cvis.TraverseCXXRecordDecl(clang::cast<clang::CXXRecordDecl>(td)) ;
|
||||
cval = cvis.get_class_data() ;
|
||||
// Check to see if this typedef is to a STL. If it is we don't want it.
|
||||
|
@ -57,7 +57,7 @@ bool VariableVisitor::VisitTemplateSpecializationType(clang::TemplateSpecializat
|
||||
if ( debug_level >=2 ) {
|
||||
td->dump() ; std::cout << std::endl ;
|
||||
}
|
||||
CXXRecordVisitor cvis(ci, cs, hsd, pa, false, false, true) ;
|
||||
CXXRecordVisitor cvis(ci, cs, hsd, pa, true) ;
|
||||
cval = cvis.get_class_data() ;
|
||||
cvis.TraverseCXXRecordDecl(clang::cast<clang::CXXRecordDecl>(td)) ;
|
||||
// Check to see if this typedef is to a STL. If it is we don't want it.
|
||||
|
Loading…
Reference in New Issue
Block a user