This line cannot generate just that error if it's the only line in the
translation unit. It would generate plenty of errors, beginning with
'boost' undefined.
Either post the complete compilable code or rephrase the question.
#ifndef EVENTSOURCE_H
#define EVENTSOURCE_H
#include "exceptions.h"
#include "debug.h"
#include "concurrency.h"
#include <list>
#include <algorithm>
#include <boost/bind.hpp>
#ifdef CURRENT_LOG_CATEGORY
#undef CURRENT_LOG_CATEGORY
#endif
#define CURRENT_LOG_CATEGORY 0x100ULL
namespace Noja
{
namespace Corba
{
template <class SinkType>
class EventSource
{
typedef typename SinkType::_var_type SinkVarType;
typedef typename SinkType::_ptr_type SinkPtrType;
std::list <SinkVarType> sinks;
mutable Mutex sinks_mutex;
template <class Op> static void fire(const Op
op, const SinkVarType sink)
{
try
{
DBG("Fire...");
op(sink);
DBG("Fire with no error");
}
catch (std::exception& ex)
{
ERROR("Caught std::exception: "
<< ex.what());
}
catch(CORBA::COMM_FAILURE& ex)
{
ERROR("System exception
(COMM_FAILURE),unable to contact the object.");
}
catch(CORBA::SystemException& ex)
{
std::string name=ex._name();
ERROR("Caught
CORBA::SystemException: " << name);
}
catch(CORBA::Exception& ex)
{
std::string name=ex._name();
ERROR("Caught
CORBA::Exception." << name);
}
catch(omniORB::fatalException& ex)
{
ERROR
(
"Caught
omniORB::fatalException thrown at position"
<<" file: "<<
ex.file()<<" line: " << ex.line() << " msg: " << ex.errmsg()
);
}
catch(...)
{
ERROR("Caught unknown exception.");
}
}
static bool is_nil(const SinkVarType obj)
{
DBG("testing for nil reference");
ASSERT_NOTNULL(obj.in());
return CORBA::is_nil(obj);
}
public:
void addSink(SinkPtrType sink)
{
Noja::Monitor<Noja::Mutex> mon(sinks_mutex);
DBG("copying sink");
SinkPtrType
sink_ptr=SinkType::_duplicate(sink);
SinkVarType sink_var=sink_ptr;
DBG("adding sink");
sinks.insert(sinks.end(),sink_var);
}
void removeSink(SinkPtrType sink)
{
Noja::Monitor<Noja::Mutex>
mon(sinks_mutex);
DBG("copying sink");
SinkVarType
sink_var=SinkType::_duplicate(sink);
DBG("removing sink");
std::remove(sinks.begin(),sinks.end(),sink_var);
}
void tidy()
{
Noja::Monitor<Noja::Mutex>
mon(sinks_mutex);
DBG("removing all NIL
(#"<<sinks.size()<<")");
std::remove_if(sinks.begin(),sinks.end(),is_nil);
DBG("after remove NIL: #"<<sinks.size());
}
template <class Op> void fireEvent(const Op
fireProc) const
{
Noja::Monitor<Noja::Mutex>
mon(sinks_mutex);
DBG("fireing events to
#"<<sinks.size()<<" sinks");
if(!sinks.empty())
std::for_each
(
sinks.begin(),
sinks.end(),
boost::bind(&EventSource<SinkType>::fire<Op>,boost::ref(fireProc),_1)
);
DBG("no error while fireing events");
}
};
}
}
#endif