Fixed -Wextra warnings
This commit is contained in:
@@ -135,7 +135,7 @@ private:
|
||||
|
||||
|
||||
|
||||
bool StandardRequestHandler::operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
bool StandardRequestHandler::operator()(const std::string& /*request_path*/, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& /*remoteEndPoint*/)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -566,7 +566,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
virtual bool operator()(const std::string& /*request_path*/, const std::string& /*full_request_path*/, const osc::ReceivedMessage& m, const IpEndpointName& /*remoteEndPoint*/)
|
||||
{
|
||||
float x(0.0f), y(0.0f);
|
||||
osc::int32 btn(0);
|
||||
@@ -619,7 +619,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
virtual bool operator()(const std::string& /*request_path*/, const std::string& /*full_request_path*/, const osc::ReceivedMessage& m, const IpEndpointName& /*remoteEndPoint*/)
|
||||
{
|
||||
try {
|
||||
float pressure(0.0f);
|
||||
@@ -650,7 +650,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
virtual bool operator()(const std::string& /*request_path*/, const std::string& /*full_request_path*/, const osc::ReceivedMessage& m, const IpEndpointName& /*remoteEndPoint*/)
|
||||
{
|
||||
try {
|
||||
osc::int32 pt(osgGA::GUIEventAdapter::UNKNOWN);
|
||||
@@ -684,7 +684,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
virtual bool operator()(const std::string& /*request_path*/, const std::string& /*full_request_path*/, const osc::ReceivedMessage& m, const IpEndpointName& /*remoteEndPoint*/)
|
||||
{
|
||||
try {
|
||||
float rotation(0.0f), tilt_x(0.0f), tilt_y(0.0f);
|
||||
@@ -744,7 +744,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
virtual bool operator()(const std::string& /*request_path*/, const std::string& /*full_request_path*/, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint)
|
||||
{
|
||||
// std::cout << m << std::endl;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/**
|
||||
* OscReceivingDevice can be used to receive osg-events via OSC from other hosts/ applications
|
||||
* It can even translate custom osc-message to user-events with attached user-data.
|
||||
*
|
||||
*
|
||||
* It uses the TUIO 1.1 Cursor2D-profile to receive multitouch-events
|
||||
*
|
||||
* This device adds to every message-bundle a message-id, so you can check, if you miss events or similar.
|
||||
@@ -26,20 +26,20 @@
|
||||
* /my_user_event/value_1 23
|
||||
* /my_user_event/value_2 42
|
||||
*
|
||||
* this will result in one osgGA:Event (when both messages are bundled) witht the name "/my_user_event",
|
||||
* this will result in one osgGA:Event (when both messages are bundled) witht the name "/my_user_event",
|
||||
* and two user-values (value_1 and value_2)
|
||||
* To get value_1 you'll do something like event->getUserValue("value_1", my_int);
|
||||
*
|
||||
* Currently osg's user-data can not cast to different types, they have to match, so
|
||||
*
|
||||
* Currently osg's user-data can not cast to different types, they have to match, so
|
||||
* event->getUserValue("value_1", my_string) will fail.
|
||||
*
|
||||
* The receiving device will try to combine multiple osc arguments intelligently, multiple osc-arguments are
|
||||
* bundled into Vec2, Vec3, Vec4 or Matrix, it depends on the number of arguments.
|
||||
|
||||
|
||||
* TUIO-specific notes:
|
||||
* If multiple TUIO-applications are transmitting their touch-points to one oscReceivingDevice, all
|
||||
* touchpoints get multiplexed, so you'll get one event with x touchpoints.
|
||||
* You can differentiate the specific applications by the touch_ids, the upper 16bits
|
||||
* touchpoints get multiplexed, so you'll get one event with x touchpoints.
|
||||
* You can differentiate the specific applications by the touch_ids, the upper 16bits
|
||||
* are specific to an application, the lower 16bits contain the touch-id for that application.
|
||||
* If you need "better" separation, use multiple oscReceivingDevices listening on different ports.
|
||||
*
|
||||
@@ -61,7 +61,7 @@ class OscReceivingDevice : public osgGA::Device, OpenThreads::Thread, osc::OscPa
|
||||
|
||||
public:
|
||||
typedef OscSendingDevice::MsgIdType MsgIdType;
|
||||
|
||||
|
||||
class RequestHandler : public osg::Referenced {
|
||||
public:
|
||||
RequestHandler(const std::string& request_path)
|
||||
@@ -70,58 +70,58 @@ public:
|
||||
, _device(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m, const IpEndpointName& remoteEndPoint) = 0;
|
||||
virtual void operator()(osgGA::EventQueue* queue) {}
|
||||
|
||||
virtual void operator()(osgGA::EventQueue* /*queue*/) {}
|
||||
|
||||
const std::string& getRequestPath() const { return _requestPath; }
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << ": no description available";
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void setDevice(OscReceivingDevice* device) { _device = device; }
|
||||
OscReceivingDevice* getDevice() const { return _device; }
|
||||
|
||||
|
||||
/// set the request-path, works only from the constructor
|
||||
void setRequestPath(const std::string& request_path) { _requestPath = request_path; }
|
||||
|
||||
|
||||
void handleException(const osc::Exception& e)
|
||||
{
|
||||
OSG_WARN << "OscDevice :: error while handling " << getRequestPath() << ": " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
double getLocalTime() const { return getDevice()->getEventQueue()->getTime(); }
|
||||
private:
|
||||
std::string _requestPath;
|
||||
OscReceivingDevice* _device;
|
||||
friend class OscReceivingDevice;
|
||||
};
|
||||
|
||||
|
||||
typedef std::multimap<std::string, osg::ref_ptr<RequestHandler> > RequestHandlerMap;
|
||||
|
||||
|
||||
OscReceivingDevice(const std::string& server_address, int listening_port);
|
||||
~OscReceivingDevice();
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void run();
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void ProcessMessage( const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint );
|
||||
virtual void ProcessPacket( const char *data, int size, const IpEndpointName& remoteEndpoint );
|
||||
virtual void ProcessBundle( const osc::ReceivedBundle& b, const IpEndpointName& remoteEndpoint );
|
||||
void addRequestHandler(RequestHandler* handler);
|
||||
|
||||
|
||||
void describeTo(std::ostream& out) const;
|
||||
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, const OscReceivingDevice& device)
|
||||
{
|
||||
device.describeTo(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
osgGA::Event* getOrCreateUserDataEvent()
|
||||
{
|
||||
if (!_userDataEvent.valid())
|
||||
@@ -130,20 +130,20 @@ public:
|
||||
}
|
||||
return _userDataEvent.get();
|
||||
}
|
||||
|
||||
|
||||
virtual const char* className() const { return "OSC receiving device"; }
|
||||
|
||||
|
||||
void addHandleOnCheckEvents(RequestHandler* handler) { _handleOnCheckEvents.push_back(handler); }
|
||||
|
||||
|
||||
virtual bool checkEvents() {
|
||||
osgGA::EventQueue* queue = getEventQueue();
|
||||
|
||||
|
||||
for(std::vector<RequestHandler*>::iterator i = _handleOnCheckEvents.begin(); i != _handleOnCheckEvents.end(); ++i) {
|
||||
(*i)->operator()(queue);
|
||||
}
|
||||
return osgGA::Device::checkEvents();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::string _listeningAddress;
|
||||
unsigned int _listeningPort;
|
||||
@@ -160,14 +160,14 @@ private:
|
||||
class SendKeystrokeRequestHandler : public OscReceivingDevice::RequestHandler {
|
||||
public:
|
||||
SendKeystrokeRequestHandler(const std::string& request_path, int key) : OscReceivingDevice::RequestHandler(request_path), _key(key) {}
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& arguments, const IpEndpointName& remoteEndPoint)
|
||||
virtual bool operator()(const std::string& /*request_path*/, const std::string& /*full_request_path*/, const osc::ReceivedMessage& /*arguments*/, const IpEndpointName& /*remoteEndPoint*/)
|
||||
{
|
||||
getDevice()->getEventQueue()->keyPress(_key);
|
||||
getDevice()->getEventQueue()->keyRelease(_key);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << ": send KEY_DOWN + KEY_UP, code: 0x" << std::hex << _key << std::dec;
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
|
||||
inline bool operator==(const ReceivedBundleElementIterator& lhs,
|
||||
const ReceivedBundleElementIterator& rhs )
|
||||
{
|
||||
{
|
||||
return lhs.IsEqualTo( rhs );
|
||||
}
|
||||
|
||||
@@ -162,8 +162,8 @@ public:
|
||||
, argument_( argument ) {}
|
||||
|
||||
friend class ReceivedMessageArgumentIterator;
|
||||
|
||||
const char TypeTag() const { return *typeTag_; }
|
||||
|
||||
char TypeTag() const { return *typeTag_; }
|
||||
|
||||
// the unchecked methods below don't check whether the argument actually
|
||||
// is of the specified type. they should only be used if you've already
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
bool IsBlob() const { return *typeTag_ == BLOB_TYPE_TAG; }
|
||||
void AsBlob( const void*& data, unsigned long& size ) const;
|
||||
void AsBlobUnchecked( const void*& data, unsigned long& size ) const;
|
||||
|
||||
|
||||
private:
|
||||
const char *typeTag_;
|
||||
const char *argument_;
|
||||
@@ -265,13 +265,13 @@ private:
|
||||
|
||||
inline bool operator==(const ReceivedMessageArgumentIterator& lhs,
|
||||
const ReceivedMessageArgumentIterator& rhs )
|
||||
{
|
||||
{
|
||||
return lhs.IsEqualTo( rhs );
|
||||
}
|
||||
|
||||
inline bool operator!=(const ReceivedMessageArgumentIterator& lhs,
|
||||
const ReceivedMessageArgumentIterator& rhs )
|
||||
{
|
||||
{
|
||||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ class ReceivedMessageArgumentStream{
|
||||
, end_( end ) {}
|
||||
|
||||
ReceivedMessageArgumentIterator p_, end_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// end of stream
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
|
||||
rhs = (*p_++).AsInt32();
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
ReceivedMessageArgumentStream& operator>>( float& rhs )
|
||||
{
|
||||
@@ -355,7 +355,7 @@ public:
|
||||
rhs = (*p_++).AsInt64();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ReceivedMessageArgumentStream& operator>>( TimeTag& rhs )
|
||||
{
|
||||
if( Eos() )
|
||||
@@ -382,7 +382,7 @@ public:
|
||||
(*p_++).AsBlob( rhs.data, rhs.size );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ReceivedMessageArgumentStream& operator>>( const char*& rhs )
|
||||
{
|
||||
if( Eos() )
|
||||
@@ -391,7 +391,7 @@ public:
|
||||
rhs = (*p_++).AsString();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ReceivedMessageArgumentStream& operator>>( Symbol& rhs )
|
||||
{
|
||||
if( Eos() )
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
ReceivedMessageArgumentStream& operator>>( MessageTerminator& rhs )
|
||||
ReceivedMessageArgumentStream& operator>>( MessageTerminator& /*rhs*/ )
|
||||
{
|
||||
if( !Eos() )
|
||||
throw ExcessArgumentException();
|
||||
@@ -429,12 +429,12 @@ public:
|
||||
|
||||
|
||||
typedef ReceivedMessageArgumentIterator const_iterator;
|
||||
|
||||
|
||||
ReceivedMessageArgumentIterator ArgumentsBegin() const
|
||||
{
|
||||
return ReceivedMessageArgumentIterator( typeTagsBegin_, arguments_ );
|
||||
}
|
||||
|
||||
|
||||
ReceivedMessageArgumentIterator ArgumentsEnd() const
|
||||
{
|
||||
return ReceivedMessageArgumentIterator( typeTagsEnd_, 0 );
|
||||
@@ -464,12 +464,12 @@ public:
|
||||
unsigned long ElementCount() const { return elementCount_; }
|
||||
|
||||
typedef ReceivedBundleElementIterator const_iterator;
|
||||
|
||||
|
||||
ReceivedBundleElementIterator ElementsBegin() const
|
||||
{
|
||||
return ReceivedBundleElementIterator( timeTag_ + 8 );
|
||||
}
|
||||
|
||||
|
||||
ReceivedBundleElementIterator ElementsEnd() const
|
||||
{
|
||||
return ReceivedBundleElementIterator( end_ );
|
||||
|
||||
Reference in New Issue
Block a user