#include <ETCL_Constraint.h>
Definition at line 60 of file ETCL_Constraint.h.
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | void | ) | [inline] |
Definition at line 7 of file ETCL_Constraint.inl.
: type_ (ACE_ETCL_UNKNOWN) { }
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | ACE_CDR::ULong | uinteger | ) | [explicit] |
Definition at line 40 of file ETCL_Constraint.cpp.
: type_ (ACE_ETCL_UNSIGNED) { this->op_.uinteger_ = uinteger; }
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | ACE_CDR::Long | integer | ) | [explicit] |
Definition at line 48 of file ETCL_Constraint.cpp.
: type_ (ACE_ETCL_SIGNED) { this->op_.integer_ = integer; }
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | ACE_CDR::Boolean | boolean | ) | [explicit] |
Definition at line 56 of file ETCL_Constraint.cpp.
: type_ (ACE_ETCL_BOOLEAN) { this->op_.bool_ = boolean; }
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | ACE_CDR::Double | doub | ) | [explicit] |
Definition at line 64 of file ETCL_Constraint.cpp.
: type_ (ACE_ETCL_DOUBLE) { this->op_.double_ = doub; }
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | const char * | str | ) | [explicit] |
Definition at line 72 of file ETCL_Constraint.cpp.
: type_ (ACE_ETCL_STRING) { this->op_.str_ = ACE::strnew (str); }
ETCL_Literal_Constraint::ETCL_Literal_Constraint | ( | const ETCL_Literal_Constraint & | lit | ) |
Copy constructor.
Definition at line 31 of file ETCL_Constraint.cpp.
: ETCL_Constraint(), type_ (ACE_ETCL_UNKNOWN) { this->copy (lit); }
ETCL_Literal_Constraint::~ETCL_Literal_Constraint | ( | void | ) | [virtual] |
Destructor.
Definition at line 80 of file ETCL_Constraint.cpp.
{ if (this->type_ == ACE_ETCL_STRING) { ACE::strdelete (this->op_.str_); } }
int ETCL_Literal_Constraint::accept | ( | ETCL_Constraint_Visitor * | visitor | ) | [virtual] |
Visitor accept method.
Reimplemented from ETCL_Constraint.
Definition at line 89 of file ETCL_Constraint.cpp.
{ return visitor->visit_literal (this); }
void ETCL_Literal_Constraint::copy | ( | const ETCL_Literal_Constraint & | co | ) | [protected] |
Private copy method.
Definition at line 435 of file ETCL_Constraint.cpp.
{ if (this->type_ == ACE_ETCL_STRING) { ACE::strdelete (this->op_.str_); } this->type_ = lit.type_; switch (this->type_) { case ACE_ETCL_STRING: this->op_.str_ = ACE::strnew (lit.op_.str_); break; case ACE_ETCL_DOUBLE: this->op_.double_ = lit.op_.double_; break; case ACE_ETCL_UNSIGNED: this->op_.uinteger_ = lit.op_.uinteger_; break; case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: this->op_.integer_ = lit.op_.integer_; break; case ACE_ETCL_BOOLEAN: this->op_.bool_ = lit.op_.bool_; break; default: this->type_ = ACE_ETCL_UNKNOWN; break; } }
Literal_Type ETCL_Literal_Constraint::expr_type | ( | void | ) | const |
Definition at line 95 of file ETCL_Constraint.cpp.
{ return this->type_; }
ETCL_Literal_Constraint::operator ACE_CDR::Boolean | ( | void | ) | const |
Definition at line 106 of file ETCL_Constraint.cpp.
{ return (this->type_ == ACE_ETCL_BOOLEAN) ? this->op_.bool_ : false; }
ETCL_Literal_Constraint::operator ACE_CDR::Double | ( | void | ) | const |
Definition at line 158 of file ETCL_Constraint.cpp.
{ switch (this->type_) { case ACE_ETCL_DOUBLE: return this->op_.double_; case ACE_ETCL_SIGNED: case ACE_ETCL_INTEGER: return (ACE_CDR::Double) this->op_.integer_; case ACE_ETCL_UNSIGNED: return (ACE_CDR::Double) this->op_.uinteger_; default: return 0.0; } }
ETCL_Literal_Constraint::operator ACE_CDR::Long | ( | void | ) | const |
Definition at line 133 of file ETCL_Constraint.cpp.
{ switch (this->type_) { case ACE_ETCL_SIGNED: case ACE_ETCL_INTEGER: return this->op_.integer_; case ACE_ETCL_UNSIGNED: return (this->op_.uinteger_ > (ACE_CDR::ULong) ACE_INT32_MAX) ? ACE_INT32_MAX : (ACE_CDR::Long) this->op_.uinteger_; case ACE_ETCL_DOUBLE: return (this->op_.double_ > 0) ? ((this->op_.double_ > ACE_INT32_MAX) ? ACE_INT32_MAX : (ACE_CDR::Long) this->op_.double_) : ((this->op_.double_ < ACE_INT32_MIN) ? ACE_INT32_MIN : (ACE_CDR::Long) this->op_.double_); default: return 0; } }
ETCL_Literal_Constraint::operator ACE_CDR::ULong | ( | void | ) | const |
Definition at line 111 of file ETCL_Constraint.cpp.
{ switch (this->type_) { case ACE_ETCL_UNSIGNED: return this->op_.uinteger_; case ACE_ETCL_SIGNED: case ACE_ETCL_INTEGER: return (this->op_.integer_ > 0) ? (ACE_CDR::ULong) this->op_.integer_ : 0; case ACE_ETCL_DOUBLE: return (this->op_.double_ > 0) ? ((this->op_.double_ > ACE_UINT32_MAX) ? ACE_UINT32_MAX : (ACE_CDR::ULong) this->op_.double_) : 0; default: return 0; } }
ETCL_Literal_Constraint::operator const char * | ( | void | ) | const |
Definition at line 174 of file ETCL_Constraint.cpp.
{ switch (this->type_) { case ACE_ETCL_STRING: return this->op_.str_; default: return 0; } }
bool ETCL_Literal_Constraint::operator!= | ( | const ETCL_Literal_Constraint & | rhs | ) | [inline] |
Definition at line 376 of file ETCL_Constraint.inl.
{ return !(*this == rhs); }
ETCL_Literal_Constraint ETCL_Literal_Constraint::operator* | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 332 of file ETCL_Constraint.cpp.
{ Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_DOUBLE: { ACE_CDR::Double result = (ACE_CDR::Double) *this * (ACE_CDR::Double) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Double) result); } case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: { ACE_CDR::Long result = (ACE_CDR::Long) *this * (ACE_CDR::Long) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Long) result); } case ACE_ETCL_UNSIGNED: { ACE_CDR::ULong result = (ACE_CDR::ULong) *this * (ACE_CDR::ULong) rhs; return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); } default: return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); } }
ETCL_Literal_Constraint ETCL_Literal_Constraint::operator+ | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 276 of file ETCL_Constraint.cpp.
{ Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_DOUBLE: { ACE_CDR::Double result = (ACE_CDR::Double) *this + (ACE_CDR::Double) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Double) result); } case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: { ACE_CDR::Long result = (ACE_CDR::Long) *this + (ACE_CDR::Long) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Long) result); } case ACE_ETCL_UNSIGNED: { ACE_CDR::ULong result = (ACE_CDR::ULong) *this + (ACE_CDR::ULong) rhs; return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); } default: return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); } }
ETCL_Literal_Constraint ETCL_Literal_Constraint::operator- | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 304 of file ETCL_Constraint.cpp.
{ Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_DOUBLE: { ACE_CDR::Double result = (ACE_CDR::Double) *this - (ACE_CDR::Double) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Double) result); } case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: { ACE_CDR::Long result = (ACE_CDR::Long) *this - (ACE_CDR::Long) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Long) result); } case ACE_ETCL_UNSIGNED: { ACE_CDR::ULong result = (ACE_CDR::ULong) *this - (ACE_CDR::ULong) rhs; return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); } default: return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); } }
ETCL_Literal_Constraint ETCL_Literal_Constraint::operator- | ( | void | ) |
Definition at line 397 of file ETCL_Constraint.cpp.
{ switch (this->type_) { case ACE_ETCL_DOUBLE: return ETCL_Literal_Constraint (- this->op_.double_); case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: return ETCL_Literal_Constraint (- this->op_.integer_); case ACE_ETCL_UNSIGNED: return ETCL_Literal_Constraint (- (ACE_CDR::Long) this->op_.uinteger_); default: return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); } }
ETCL_Literal_Constraint ETCL_Literal_Constraint::operator/ | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 360 of file ETCL_Constraint.cpp.
{ Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_DOUBLE: { if ((ACE_CDR::Double) rhs == 0.0) return ETCL_Literal_Constraint ((ACE_CDR::Double) 0.0); ACE_CDR::Double result = (ACE_CDR::Double) *this / (ACE_CDR::Double) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Double) result); } case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: { if ((ACE_CDR::Long) rhs == 0) return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); ACE_CDR::Long result = (ACE_CDR::Long) *this / (ACE_CDR::Long) rhs; return ETCL_Literal_Constraint ((ACE_CDR::Long) result); } case ACE_ETCL_UNSIGNED: { if ((ACE_CDR::ULong) rhs == 0) return ETCL_Literal_Constraint ((ACE_CDR::ULong) 0); ACE_CDR::ULong result = (ACE_CDR::ULong) *this / (ACE_CDR::ULong) rhs; return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); } default: return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); } }
bool ETCL_Literal_Constraint::operator< | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 217 of file ETCL_Constraint.cpp.
{ bool return_value = false; Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_STRING: return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) < 0); break; case ACE_ETCL_DOUBLE: return_value = (ACE_CDR::Double) *this < (ACE_CDR::Double) rhs; break; case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: return_value = (ACE_CDR::Long) *this < (ACE_CDR::Long) rhs; break; case ACE_ETCL_UNSIGNED: return_value = (ACE_CDR::ULong) *this < (ACE_CDR::ULong) rhs; break; case ACE_ETCL_BOOLEAN: return_value = (ACE_CDR::Boolean) *this < (ACE_CDR::Boolean) rhs; break; default: break; } return return_value; }
bool ETCL_Literal_Constraint::operator<= | ( | const ETCL_Literal_Constraint & | rhs | ) | [inline] |
Definition at line 382 of file ETCL_Constraint.inl.
{ return !(*this > rhs); }
void ETCL_Literal_Constraint::operator= | ( | const ETCL_Literal_Constraint & | co | ) |
bool ETCL_Literal_Constraint::operator== | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 186 of file ETCL_Constraint.cpp.
{ bool return_value = false; Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_STRING: return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) == 0); break; case ACE_ETCL_DOUBLE: return_value = (ACE_CDR::Double) *this == (ACE_CDR::Double) rhs; break; case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: return_value = (ACE_CDR::Long) *this == (ACE_CDR::Long) rhs; break; case ACE_ETCL_UNSIGNED: return_value = (ACE_CDR::ULong) *this == (ACE_CDR::ULong) rhs; break; case ACE_ETCL_BOOLEAN: return_value = (ACE_CDR::Boolean) *this == (ACE_CDR::Boolean) rhs; break; default: break; } return return_value; }
bool ETCL_Literal_Constraint::operator> | ( | const ETCL_Literal_Constraint & | rhs | ) |
Definition at line 248 of file ETCL_Constraint.cpp.
{ bool return_value = false; Literal_Type widest_type = this->widest_type (rhs); switch (widest_type) { case ACE_ETCL_STRING: return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) > 0); break; case ACE_ETCL_DOUBLE: return_value = (ACE_CDR::Double) *this > (ACE_CDR::Double) rhs; break; case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: return_value = (ACE_CDR::Long) *this > (ACE_CDR::Long) rhs; break; case ACE_ETCL_UNSIGNED: return_value = (ACE_CDR::ULong) *this > (ACE_CDR::ULong) rhs; break; default: break; } return return_value; }
bool ETCL_Literal_Constraint::operator>= | ( | const ETCL_Literal_Constraint & | rhs | ) | [inline] |
Definition at line 388 of file ETCL_Constraint.inl.
{ return !(*this < rhs); }
Literal_Type ETCL_Literal_Constraint::widest_type | ( | const ETCL_Literal_Constraint & | rhs | ) | [virtual] |
Ensure both operands are of the same simple numeric type.
Definition at line 414 of file ETCL_Constraint.cpp.
{ Literal_Type rhs_type = rhs.expr_type (); Literal_Type return_value = rhs_type; if (rhs_type != this->type_) { if (rhs_type > this->type_) { return_value = rhs_type; } else { return_value = this->type_; } } return return_value; }
Definition at line 149 of file ETCL_Constraint.h.
Definition at line 150 of file ETCL_Constraint.h.
Definition at line 148 of file ETCL_Constraint.h.
union { ... } ETCL_Literal_Constraint::op_ [protected] |
Union of the possible literal types.
Definition at line 146 of file ETCL_Constraint.h.
Literal_Type ETCL_Literal_Constraint::type_ [protected] |
The actual types of the ETCL_Literal_Constraint.
Definition at line 154 of file ETCL_Constraint.h.
Definition at line 147 of file ETCL_Constraint.h.