📄 etcl_constraint.cpp
字号:
case TAO_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) <= 0);
break;
case TAO_ETCL_DOUBLE:
return_value = (CORBA::Double) *this <= (CORBA::Double) rhs;
break;
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
return_value = (CORBA::Long) *this <= (CORBA::Long) rhs;
break;
case TAO_ETCL_UNSIGNED:
return_value = (CORBA::ULong) *this <= (CORBA::ULong) rhs;
break;
default:
break;
}
return return_value;
}
CORBA::Boolean
TAO_ETCL_Literal_Constraint::operator> (const TAO_ETCL_Literal_Constraint & rhs)
{
int return_value = 0;
TAO_Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case TAO_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) > 0);
break;
case TAO_ETCL_DOUBLE:
return_value = (CORBA::Double) *this > (CORBA::Double) rhs;
break;
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
return_value = (CORBA::Long) *this > (CORBA::Long) rhs;
break;
case TAO_ETCL_UNSIGNED:
return_value = (CORBA::ULong) *this > (CORBA::ULong) rhs;
break;
default:
break;
}
return return_value;
}
CORBA::Boolean
TAO_ETCL_Literal_Constraint::operator>= (const TAO_ETCL_Literal_Constraint & rhs)
{
int return_value = 0;
TAO_Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case TAO_ETCL_STRING:
return_value =
(ACE_OS::strcmp ((const char*) *this, (const char*) rhs) >= 0);
break;
case TAO_ETCL_DOUBLE:
return_value = (CORBA::Double) *this >= (CORBA::Double) rhs;
break;
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
return_value = (CORBA::Long) *this >= (CORBA::Long) rhs;
break;
case TAO_ETCL_UNSIGNED:
return_value = (CORBA::ULong) *this >= (CORBA::ULong) rhs;
break;
default:
break;
}
return return_value;
}
TAO_ETCL_Literal_Constraint
TAO_ETCL_Literal_Constraint::operator+ (const TAO_ETCL_Literal_Constraint & rhs)
{
TAO_Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case TAO_ETCL_DOUBLE:
{
CORBA::Double result = (CORBA::Double) *this + (CORBA::Double) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Double) result);
}
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
{
CORBA::Long result = (CORBA::Long) *this + (CORBA::Long) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Long) result);
}
case TAO_ETCL_UNSIGNED:
{
CORBA::ULong result = (CORBA::ULong) *this + (CORBA::ULong) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::ULong) result);
}
default:
return TAO_ETCL_Literal_Constraint ((CORBA::Long) 0);
}
}
TAO_ETCL_Literal_Constraint
TAO_ETCL_Literal_Constraint::operator- (const TAO_ETCL_Literal_Constraint & rhs)
{
TAO_Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case TAO_ETCL_DOUBLE:
{
CORBA::Double result = (CORBA::Double) *this - (CORBA::Double) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Double) result);
}
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
{
CORBA::Long result = (CORBA::Long) *this - (CORBA::Long) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Long) result);
}
case TAO_ETCL_UNSIGNED:
{
CORBA::ULong result = (CORBA::ULong) *this - (CORBA::ULong) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::ULong) result);
}
default:
return TAO_ETCL_Literal_Constraint ((CORBA::Long) 0);
}
}
TAO_ETCL_Literal_Constraint
TAO_ETCL_Literal_Constraint::operator* (const TAO_ETCL_Literal_Constraint & rhs)
{
TAO_Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case TAO_ETCL_DOUBLE:
{
CORBA::Double result = (CORBA::Double) *this * (CORBA::Double) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Double) result);
}
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
{
CORBA::Long result = (CORBA::Long) *this * (CORBA::Long) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Long) result);
}
case TAO_ETCL_UNSIGNED:
{
CORBA::ULong result = (CORBA::ULong) *this * (CORBA::ULong) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::ULong) result);
}
default:
return TAO_ETCL_Literal_Constraint ((CORBA::Long) 0);
}
}
TAO_ETCL_Literal_Constraint
TAO_ETCL_Literal_Constraint::operator/ (const TAO_ETCL_Literal_Constraint & rhs)
{
TAO_Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case TAO_ETCL_DOUBLE:
{
CORBA::Double result = (CORBA::Double) *this / (CORBA::Double) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Double) result);
}
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
{
CORBA::Long result = (CORBA::Long) *this / (CORBA::Long) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::Long) result);
}
case TAO_ETCL_UNSIGNED:
{
CORBA::ULong result = (CORBA::ULong) *this / (CORBA::ULong) rhs;
return TAO_ETCL_Literal_Constraint ((CORBA::ULong) result);
}
default:
return TAO_ETCL_Literal_Constraint ((CORBA::Long) 0);
}
}
TAO_ETCL_Literal_Constraint
TAO_ETCL_Literal_Constraint::operator- (void)
{
switch (this->type_)
{
case TAO_ETCL_DOUBLE:
return TAO_ETCL_Literal_Constraint (- this->op_.double_);
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
return TAO_ETCL_Literal_Constraint (- this->op_.integer_);
case TAO_ETCL_UNSIGNED:
return TAO_ETCL_Literal_Constraint (- (CORBA::Long) this->op_.uinteger_);
default:
return TAO_ETCL_Literal_Constraint ((CORBA::Long) 0);
}
}
TAO_Literal_Type
TAO_ETCL_Literal_Constraint::widest_type (
const TAO_ETCL_Literal_Constraint & rhs
)
{
TAO_Literal_Type rhs_type = rhs.expr_type ();
TAO_Literal_Type return_value = rhs_type;
if (rhs_type == TAO_ETCL_COMPONENT)
{
CORBA::TypeCode_var tc = rhs.op_.any_->type ();
rhs_type = this->comparable_type (tc.in ());
}
else if (rhs_type != this->type_)
{
if (rhs_type > this->type_)
{
return_value = rhs_type;
}
else
{
return_value = this->type_;
}
}
return return_value;
}
void
TAO_ETCL_Literal_Constraint::copy (const TAO_ETCL_Literal_Constraint &lit)
{
this->type_ = lit.type_;
switch (this->type_)
{
case TAO_ETCL_STRING:
this->op_.str_ = CORBA::string_dup (lit.op_.str_);
break;
case TAO_ETCL_DOUBLE:
this->op_.double_ = lit.op_.double_;
break;
case TAO_ETCL_UNSIGNED:
this->op_.uinteger_ = lit.op_.uinteger_;
break;
case TAO_ETCL_INTEGER:
case TAO_ETCL_SIGNED:
this->op_.integer_ = lit.op_.integer_;
break;
case TAO_ETCL_BOOLEAN:
this->op_.bool_ = lit.op_.bool_;
break;
case TAO_ETCL_COMPONENT:
this->op_.any_ = lit.op_.any_;
break;
default:
this->type_ = TAO_UNKNOWN;
break;
}
}
// ****************************************************************
int
TAO_ETCL_Identifier::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_identifier (this);
}
// ****************************************************************
TAO_ETCL_Union_Value::~TAO_ETCL_Union_Value (void)
{
delete this->string_;
delete this->integer_;
}
int
TAO_ETCL_Union_Value::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_union_value (this);
}
// ****************************************************************
TAO_ETCL_Union_Pos::~TAO_ETCL_Union_Pos (void)
{
delete this->component_;
delete this->union_value_;
}
int
TAO_ETCL_Union_Pos::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_union_pos (this);
}
// ****************************************************************
TAO_ETCL_Component_Pos::~TAO_ETCL_Component_Pos (void)
{
delete this->component_;
delete this->integer_;
}
int
TAO_ETCL_Component_Pos::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_pos (this);
}
// ****************************************************************
TAO_ETCL_Component_Assoc::~TAO_ETCL_Component_Assoc (void)
{
delete this->component_;
delete this->identifier_;
}
int
TAO_ETCL_Component_Assoc::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_assoc (this);
}
// ****************************************************************
TAO_ETCL_Component_Array::~TAO_ETCL_Component_Array (void)
{
delete this->component_;
delete this->integer_;
}
int
TAO_ETCL_Component_Array::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_array (this);
}
// ****************************************************************
TAO_ETCL_Special::~TAO_ETCL_Special (void)
{
}
int
TAO_ETCL_Special::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_special (this);
}
// ****************************************************************
TAO_ETCL_Component::~TAO_ETCL_Component (void)
{
delete this->component_;
delete this->identifier_;
}
int
TAO_ETCL_Component::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component (this);
}
// ****************************************************************
TAO_ETCL_Dot::~TAO_ETCL_Dot (void)
{
delete this->component_;
}
int
TAO_ETCL_Dot::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_dot (this);
}
// ****************************************************************
TAO_ETCL_Eval::~TAO_ETCL_Eval (void)
{
delete this->component_;
}
int
TAO_ETCL_Eval::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_eval (this);
}
// ****************************************************************
TAO_ETCL_Default::~TAO_ETCL_Default (void)
{
delete this->component_;
}
int
TAO_ETCL_Default::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_default (this);
}
// ****************************************************************
TAO_ETCL_Exist::~TAO_ETCL_Exist (void)
{
delete this->component_;
}
int
TAO_ETCL_Exist::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_exist (this);
}
// ****************************************************************
TAO_ETCL_Unary_Expr::~TAO_ETCL_Unary_Expr (void)
{
delete this->subexpr_;
}
int
TAO_ETCL_Unary_Expr::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_unary_expr (this);
}
// ****************************************************************
TAO_ETCL_Binary_Expr::~TAO_ETCL_Binary_Expr (void)
{
delete this->lhs_;
delete this->rhs_;
}
int
TAO_ETCL_Binary_Expr::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_binary_expr (this);
}
// ****************************************************************
TAO_ETCL_Preference::~TAO_ETCL_Preference (void)
{
delete this->subexpr_;
}
int
TAO_ETCL_Preference::accept (TAO_ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_preference (this);
}
// ****************************************************************
TAO_ETCL_Constraint_Visitor::~TAO_ETCL_Constraint_Visitor (void)
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -