1// Filename: Class.ipp 2namespace dclass // open namespace 3{ 4 5 6// get_num_parents returns the number of superclasses this class inherits from. 7inline size_t Class::get_num_parents() const 8{ 9 return m_parents.size(); 10} 11// get_parent returns the <n>th parent-/super-class this class inherits from. 12inline Class* Class::get_parent(unsigned int n) 13{ 14 return m_parents.at(n); 15} 16inline const Class* Class::get_parent(unsigned int n) const 17{ 18 return m_parents.at(n); 19} 20 21// get_num_children returns the number of subclasses that inherit from this class. 22inline size_t Class::get_num_children() const 23{ 24 return m_children.size(); 25} 26// get_child returns the <n>th child-/sub-class that inherits this class. 27inline Class* Class::get_child(unsigned int n) 28{ 29 return m_children.at(n); 30} 31inline const Class* Class::get_child(unsigned int n) const 32{ 33 return m_children.at(n); 34} 35 36// has_constructor returns true if this class has a constructor method, 37// or false if it just uses the default constructor. 38inline bool Class::has_constructor() const 39{ 40 return (m_constructor != nullptr); 41} 42// get_constructor returns the constructor method for this class if it is defined, 43// or nullptr if the class uses the default constructor. 44inline Field* Class::get_constructor() 45{ 46 return m_constructor; 47} 48inline const Field* Class::get_constructor() const 49{ 50 return m_constructor; 51} 52 53// get_num_base_fields returns the number of fields declared directly in this class. 54inline size_t Class::get_num_base_fields() const 55{ 56 return m_base_fields.size(); 57} 58// get_base_field returns the <n>th field from the class excluding any inherited fields. 59inline Field* Class::get_base_field(unsigned int n) 60{ 61 return m_base_fields.at(n); 62} 63inline const Field* Class::get_base_field(unsigned int n) const 64{ 65 return m_base_fields.at(n); 66} 67 68 69} // close namespace dclass 70