Added virtual destructors

release/4.3a0
Frank Dellaert 2018-09-27 00:23:17 -04:00
parent 4ed362dfd4
commit 9c3949f738
2 changed files with 19 additions and 8 deletions

View File

@ -48,14 +48,23 @@ public:
} Category; } Category;
Category category; Category category;
/// Default constructor
Qualified() : Qualified() :
category(VOID) { category(VOID) {
} }
/// Construct from name and optional category
Qualified(const std::string& n, Category c = CLASS) : Qualified(const std::string& n, Category c = CLASS) :
name_(n), category(c) { name_(n), category(c) {
} }
/// Construct from scoped name and optional category
Qualified(const std::string& ns1, const std::string& n, Category c = CLASS) :
name_(n), category(c) {
namespaces_.push_back(ns1);
}
/// Construct from doubly scoped name and optional category
Qualified(const std::string& ns1, const std::string& ns2, Qualified(const std::string& ns1, const std::string& ns2,
const std::string& n, Category c = CLASS) : const std::string& n, Category c = CLASS) :
name_(n), category(c) { name_(n), category(c) {
@ -63,15 +72,14 @@ public:
namespaces_.push_back(ns2); namespaces_.push_back(ns2);
} }
Qualified(const std::string& ns1, const std::string& n, Category c = CLASS) : /// Construct from arbitrarily scoped name
name_(n), category(c) {
namespaces_.push_back(ns1);
}
Qualified(std::vector<std::string> ns, const std::string& name) : Qualified(std::vector<std::string> ns, const std::string& name) :
namespaces_(ns), name_(name), category(CLASS) { namespaces_(ns), name_(name), category(CLASS) {
} }
// Destructor
virtual ~Qualified() {}
std::string name() const { std::string name() const {
return name_; return name_;
} }

View File

@ -27,21 +27,24 @@ struct ReturnValue {
friend struct ReturnValueGrammar; friend struct ReturnValueGrammar;
/// Constructor /// Default constructor
ReturnValue() : ReturnValue() :
isPair(false) { isPair(false) {
} }
/// Constructor /// Construct from type
ReturnValue(const ReturnType& type) : ReturnValue(const ReturnType& type) :
isPair(false), type1(type) { isPair(false), type1(type) {
} }
/// Constructor /// Construct from pair type arguments
ReturnValue(const ReturnType& t1, const ReturnType& t2) : ReturnValue(const ReturnType& t1, const ReturnType& t2) :
isPair(true), type1(t1), type2(t2) { isPair(true), type1(t1), type2(t2) {
} }
/// Destructor
virtual ~ReturnValue() {}
virtual void clear() { virtual void clear() {
type1.clear(); type1.clear();
type2.clear(); type2.clear();