本文整理汇总了C++中orcaice::Context::tracer方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::tracer方法的具体用法?C++ Context::tracer怎么用?C++ Context::tracer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orcaice::Context
的用法示例。
在下文中一共展示了Context::tracer方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elementType
void
loadElementsFromConfigFile( orcaqgemv::GuiElementModel &guiElementModel,
const orcaice::Context &context )
{
// create a map of types
const string typePrefix = context.tag() + ".Config.Element.Type";
std::map<string,string> typeMap = context.properties()->getPropertiesForPrefix(typePrefix);
// create a map of descriptions
const string descriptionPrefix = context.tag() + ".Config.Element.Description";
std::map<string,string> descriptionMap = context.properties()->getPropertiesForPrefix(descriptionPrefix);
// debug output
for ( map<string,string>::iterator it=typeMap.begin(); it!=typeMap.end(); ++it )
{
stringstream ss;
ss << "it->first: " << it->first << endl;
ss << "it->second: " << it->second << endl;
context.tracer().debug( ss.str(), 5 );
}
// create elements based on Type entries
for ( map<string,string>::iterator it = typeMap.begin(); it != typeMap.end(); ++it )
{
// extract the key: e.g. for Config.Element.TypeXX the key is XX
QString elementType( it->second.c_str() );
string key = it->first.substr( typePrefix.size() );
stringstream ss; ss << "Extracted key is: " << key;
context.tracer().debug( ss.str(), 5 );
// find the corresponding entry in the descriptionMap
map<string,string>::iterator descriptionMapIt = descriptionMap.find( context.tag() + ".Config.Element.Description" + key );
if ( descriptionMapIt==descriptionMap.end() )
{
ss.str(""); ss << "'Description' entry with key " << key << " expected. Check your config file!";
context.tracer().warning( ss.str() );
continue;
}
// found an entry
ss.str(""); ss << "Found Description entry: " << descriptionMapIt->second;
context.tracer().debug( ss.str(), 5 );
//
// assemble all pieces to create the GUI element
//
QString elementDescription( descriptionMapIt->second.c_str() );
QString uniqueId = extractUniqueId( elementDescription );
QString platformName = extractPlatformName( elementDescription );
guiElementModel.createGuiElement( elementType, elementDescription, platformName, uniqueId );
}
}
示例2: string
void
TestThread::initialise()
{
context_.tracer().info( "TestThread::initialise()" );
try
{
throw string("Error in initialise()");
}
catch (...)
{
orcaice::catchExceptions( context_.tracer(), "initialising" );
}
}
示例3:
MainThread::MainThread( const orcaice::Context &context )
: orcaice::SubsystemThread( context.tracer(), context.status(), "MainThread" )
, context_(context)
, descr_(new orca::ImageDescription())
, config_()
{
}
示例4: SubsystemThread
MainThread::MainThread( const orcaice::Context& context ) :
SubsystemThread( context.tracer(), context.status(), "MainThread" ),
context_(context)
{
// this subsystem will initialise and exit, but the component will continue running.
setSubsystemType( gbxutilacfr::SubsystemEarlyExit );
}
示例5: helper
void
MultiCameraReader::readFromFile( std::ifstream *file,
const std::string &format,
orcaice::Context context,
orca::MultiCameraDescriptionPtr &obj )
{
descr_ = new orca::MultiCameraDescription();
if ( format=="ice" )
{
orcalog::IceReadHelper helper( context.communicator(), file );
ice_readMultiCameraDescription( helper.stream_, obj );
helper.read();
}
else if ( format=="jpeg" || format=="bmp" || format=="avi")
{
#ifndef OPENCV_FOUND
std::stringstream infostring;
infostring << "Images can only be replayed in '" << format << "' format if you have OpenCV.";
context.tracer().info( infostring.str() );
context.tracer().info( "Please have a look at the documentation for installing OpenCV." );
std::stringstream errorstring;
errorstring << "Logger: '"<< format <<"' format not supported because OpenCV is not installed.";
throw orcalog::FormatNotSupportedException( ERROR_INFO, errorstring.str() );
#endif
// Populate the description with data from the file
std::string line;
std::getline( *file, line );
std::stringstream ss( line );
fromLogString( ss, descr_ );
// Point the descriptor pointer to our copy of it
obj = descr_;
}
else
{
stringstream ss;
ss << "can't handle format: " << format;
throw orcalog::FormatNotSupportedException( ERROR_INFO, ss.str() );
}
// Now that we know the size, initialise the data storage
initDataStorage();
}
示例6: if
MainThread::MainThread( const orcaice::Context & context ) :
SafeThread(context.tracer()),
context_(context)
{
//
// Read settings
//
string prefix = context_.tag() + ".Config.";
update_interval = orcaice::getPropertyAsDoubleWithDefault( context_.properties(), prefix+"UpdateInterval", 0.1 );
// based on the config parameter, create the right driver
string driverName = orcaice::getPropertyWithDefault( context_.properties(),
prefix+"Driver", "static" );
if ( driverName == "static" )
{
std::string driverPrefix = prefix + "Static.";
orca::Frame2d pose;
orcaobj::setInit(pose);
pose = orcaobj::getPropertyAsFrame2dWithDefault( context_.properties(),
driverPrefix+"Pose", pose );
driver_ = new StaticDriver( pose );
}
else if ( driverName == "stage" )
{
#ifdef HAVE_STAGE_DRIVER
context_.tracer().debug( "loading Player-Client driver",3);
std::string driverPrefix = prefix + "Stage.";
std::string playerHost = orcaice::getPropertyWithDefault( context_.properties(),
driverPrefix+"Host", "localhost" );
int playerPort = orcaice::getPropertyAsIntWithDefault( context_.properties(),
driverPrefix+"Port", 6665 );
std::string playerId = orcaice::getPropertyWithDefault( context_.properties(),
driverPrefix+"Id", "model1" );
driver_ = new StageDriver( playerHost.c_str(), playerPort, playerId.c_str() );
#else
// unrecoverable error
context_.shutdown();
throw gbxutilacfr::Exception( ERROR_INFO, "Can't instantiate driver 'stage' because it was not built!" );
#endif
}
context_.tracer().debug("driver instantiated",5);
}
示例7: Exception
void
TestThread::finalise()
{
context_.tracer().info( "TestThread::finalise()" );
try {
throw gbxutilacfr::Exception( ERROR_INFO, "Error in finalise()" );
}
catch ( ... ) {
// orcaice::catchExceptions( context_.tracer(), "finalising" );
// orcaice::catchExceptionsWithStatus( "finalising", health() );
orcaice::catchExceptionsWithStatus( "finalising", health(), gbxutilacfr::SubsystemWarning );
// orcaice::catchExceptionsWithStatusAndSleep( "finalising", health(), gbxutilacfr::SubsystemWarning );
}
context_.shutdown();
}
示例8: SubsystemThread
HwThread::HwThread( const orcaice::Context &context ) :
SubsystemThread( context.tracer(), context.status(), "HwThread" ),
context_(context)
{
setMaxHeartbeatInterval( 10.0 );
//
// Read settings
//
Ice::PropertiesPtr prop = context_.properties();
std::string prefix = context_.tag() + ".Config.";
isMotionEnabled_ = (bool)orcaice::getPropertyAsIntWithDefault( prop, prefix+"EnableMotion", 1 );
// Dynamically load the library and find the factory
std::string driverLibName =
orcaice::getPropertyWithDefault( prop, prefix+"DriverLib", "libHydroBicyclePlayerClient.so" );
context_.tracer().debug( "HwThread: Loading driver library "+driverLibName, 4 );
// The factory which creates the driver
std::auto_ptr<hydrointerfaces::BicycleFactory> driverFactory;
try {
driverLib_.reset( new hydrodll::DynamicallyLoadedLibrary(driverLibName) );
driverFactory.reset(
hydrodll::dynamicallyLoadClass<hydrointerfaces::BicycleFactory,BicycleDriverFactoryMakerFunc>
( *driverLib_, "createBicycleDriverFactory" ) );
}
catch (hydrodll::DynamicLoadException &e)
{
context_.tracer().error( e.what() );
throw;
}
// create the driver
try {
context_.tracer().info( "HwThread: Creating driver..." );
driver_.reset( driverFactory->createDriver( context_.toHydroContext() ) );
}
catch ( ... )
{
stringstream ss;
ss << "HwThread: Caught unknown exception while creating driver";
context_.tracer().error( ss.str() );
throw;
}
}
示例9: SubsystemThread
ReplayConductor::ReplayConductor( orcalog::MasterFileReader &masterFileReader,
std::vector<orcalog::Replayer*> &replayers,
const IceUtil::Time &beginTime,
double replayRate,
const orcaice::Context &context )
: SubsystemThread( context.tracer(), context.status() ),
isPlaying_(false),
isPlayingOrAboutToStart_(false),
masterFileReader_(masterFileReader),
replayers_(replayers),
context_(context)
{
clock_.setReplayRate(replayRate);
bool cursorValid = masterFileReader_.getCursorTime( firstItemSec_, firstItemUsec_ );
assert( cursorValid );
// Fast-forward if non-zero beginTime
if ( beginTime > orcalog::iceUtilTime(0,0) )
{
fastForward( beginTime );
}
}
示例10: assert
IceGrid::QueryPrx
getDefaultQuery( const orcaice::Context& context )
{
Ice::CommunicatorPtr ic = context.communicator();
assert( ic );
Ice::ObjectPrx locatorPrx = ic->getDefaultLocator();
Ice::Identity locatorId = locatorPrx->ice_getIdentity();
Ice::Identity queryId;
queryId.category = locatorId.category;
queryId.name = "Query";
Ice::ObjectPrx objPrx = ic->stringToProxy( ic->identityToString( queryId ) );
IceGrid::QueryPrx queryPrx;
try {
// objPrx->ice_ping();
// string address = orcacm::connectionToRemoteAddress( queryPrx->ice_getConnection()->toString() );
// std::ostringstream os;
// os<<"Registry ping successful: "<<data.address;
// context.tracer().debug( os.str() );
queryPrx = IceGrid::QueryPrx::checkedCast( objPrx );
}
catch ( const Ice::Exception& e ) {
// what do we do?
ostringstream os;
os << "(while looking for IceGrid Query interface) :"<<e.what();
context.tracer().warning( os.str() );
}
return queryPrx;
}
示例11:
TestThread::TestThread( Config config, const orcaice::Context &context ) :
orcaice::SubsystemThread( context.tracer(), context.status() ),
config_( config ),
context_(context)
{
}
示例12: SafeThread
MainThread::MainThread( const orcaice::Context& context ) :
SafeThread(context.tracer()),
context_(context)
{
}
示例13: SubsystemThread
MainThread::MainThread( const orcaice::Context& context ) :
SubsystemThread( context.tracer(), context.status(), "MainThread" ),
context_(context)
{
setMaxHeartbeatInterval( 20.0 );
}
示例14: SafeThread
InputThread::InputThread( Network* network, const orcaice::Context& context ) :
SafeThread( context.tracer() ),
network_(network),
context_(context)
{
}