本文整理汇总了C++中tango::Attribute类的典型用法代码示例。如果您正苦于以下问题:C++ Attribute类的具体用法?C++ Attribute怎么用?C++ Attribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Attribute类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_attr
void MyClass::read_attr(Tango::Attribute &attr)
{
...
...
if (attr_name == "Sinusoide")
{
struct timeval tv;
gettimeofday(&tv, NULL);
sinusoide = 100 * sin( 2 * 3.14 * frequency * tv.tv_sec);
attr.set_value(&sinusoide);
if (sinusoide >= 0)
{
vector<string> filterable_names;
vector<double> filterable_value;
filterable_names.push_back("value");
filterable_value.push_back((double)sinusoide);
push_event( filterable_names,
filterable_value,
attr);
attr.set_value(&sinusoide);
}
}
....
....
}
示例2: read_attr
void DocDs::read_attr(Tango::Attribute &attr)
{
string &attr_name = attr.get_name();
cout << "In read_attr for attribute " << attr_name << endl;
// Switch on attribute name
//---------------------------------
if (attr_name == "LongRdAttr")
{
// Add your own code here
attr.set_value(&attr_rd);
}
if (attr_name == "LongWrAttr")
{
// Add your own code here
attr.set_value(&attr_wr);
}
if (attr_name == "StrAttr")
{
// Add your own code here
attr_str_array[0] = CORBA::string_dup("Rock");
attr_str_array[1] = CORBA::string_dup("Samba");
attr.set_value(attr_str_array, 2);
}
}
示例3: read_exposureTime
//+----------------------------------------------------------------------------
//
// method : SimulatorCCD::read_exposureTime
//
// description : Extract real attribute values for exposureTime acquisition result.
//
//-----------------------------------------------------------------------------
void SimulatorCCD::read_exposureTime(Tango::Attribute &attr)
{
DEBUG_STREAM << "SimulatorCCD::read_exposureTime(Tango::Attribute &attr) entering... "<< endl;
if(m_ct!=0)
{
try
{
double exposure;
m_ct->acquisition()->getAcqExpoTime(exposure);
*attr_exposureTime_read = (Tango::DevDouble)(exposure*1000.0);
attr.set_value(attr_exposureTime_read);
}
catch(Tango::DevFailed& df)
{
ERROR_STREAM << df << endl;
//- rethrow exception
Tango::Except::re_throw_exception(df,
static_cast<const char*> ("TANGO_DEVICE_ERROR"),
static_cast<const char*> (string(df.errors[0].desc).c_str()),
static_cast<const char*> ("SimulatorCCD::read_exposureTime"));
}
catch(Exception& e)
{
ERROR_STREAM << e.getErrMsg() << endl;
//- throw exception
Tango::Except::throw_exception(
static_cast<const char*> ("TANGO_DEVICE_ERROR"),
static_cast<const char*> (e.getErrMsg().c_str()),
static_cast<const char*> ("SimulatorCCD::read_exposureTime"));
}
}
DEBUG_STREAM << "SimulatorCCD::read_exposureTime() ending... "<< endl;
}
示例4: df
void GrabberAttrT<std::string>::read(Tango::DeviceImpl* dev, Tango::Attribute &att)
{
//- retrieve the value from the plugin :
try
{
this->callbacks_[dev].info.get_cb( this->callbacks_[dev].read_value );
if (this->callbacks_[dev].read_value.empty())
THROW_DEVFAILED("NO_VALUE",
"No value has been assigned to the container",
"PlugInAttr<std::string>::read");
this->callbacks_[dev].read_ptr = const_cast<char*>( (yat::any_cast<std::string>(&this->callbacks_[dev].read_value))->c_str() );
att.set_value( &this->callbacks_[dev].read_ptr );
}
catch( yat::Exception& ex )
{
yat4tango::YATDevFailed df(ex);
RETHROW_DEVFAILED(df,
"SOFTWARE_FAILURE",
"Error while reading a plugin attribute",
"PlugInAttr<std::string>::read");
}
catch( ... )
{
THROW_DEVFAILED("UNKNWON_ERROR",
"Unknwon error while reading a plugin attribute",
"PlugInAttr<std::string>::read");
}
}
示例5:
//+----------------------------------------------------------------------------
//
// method : UviewCCD::read_ivsTRoi4
//
// description : Extract real attribute values for ivsTRoi4 acquisition result.
//
//-----------------------------------------------------------------------------
void UviewCCD::read_ivsTRoi4(Tango::Attribute &attr)
{
DEBUG_STREAM << "UviewCCD::read_ivsTRoi4(Tango::Attribute &attr) entering... "<< endl;
if (!m_roi4Enable)
*attr_ivsTRoi4_read = yat::IEEE_NAN;
attr.set_value(attr_ivsTRoi4_read);
}
示例6: read_MyAttr
//--------------------------------------------------------
void MyFirstDS::read_MyAttr(Tango::Attribute &attr)
{
DEBUG_STREAM << "MyFirstDS::read_MyAttr(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(MyFirstDS::read_MyAttr) ENABLED START -----*/
// Set the attribute value
attr.set_value(attr_MyAttr_read);
/*----- PROTECTED REGION END -----*/ // MyFirstDS::read_MyAttr
}
示例7: read_Spectrum
//--------------------------------------------------------
void StateScanner::read_Spectrum(Tango::Attribute &attr)
{
DEBUG_STREAM << "StateScanner::read_Spectrum(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(StateScanner::read_Spectrum) ENABLED START -----*/
machine_->update_spectrum(attr_Spectrum_read, 2048);
// Set the attribute value
attr.set_value(attr_Spectrum_read, 2048);
/*----- PROTECTED REGION END -----*/ // StateScanner::read_Spectrum
}
示例8: read_Sensor
//--------------------------------------------------------
void StateScanner::read_Sensor(Tango::Attribute &attr)
{
DEBUG_STREAM << "StateScanner::read_Sensor(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(StateScanner::read_Sensor) ENABLED START -----*/
pData d = machine_->data();
attr_Sensor_read[0] = d->name_sensor;
// Set the attribute value
attr.set_value(attr_Sensor_read);
/*----- PROTECTED REGION END -----*/ // StateScanner::read_Sensor
}
示例9: read_Position
void read_Position(Tango::Attribute &att)
{
att.set_value(attr_Position_read);
}