Show
Ignore:
Timestamp:
03/23/09 10:52:00 (15 years ago)
Author:
bhilburn
Message:

Implemented the GetRemoteComponentType? function is the components header
for all subclasses of 'component'.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/include/vtcross/components.h

    r188 r190  
    2323 
    2424#include "containers.h" 
     25#include "socketcomm.h" 
    2526 
    2627 
     
    3334    public: 
    3435        /* Asks the component at the passed socket FD for its component type 
    35          * string. 
    36          */ 
    37         virtual void GetRemoteComponentType() = 0; 
     36         * string.  Note that this implementation is global for all component 
     37         * types, so is implemented here.  Should a component need to override 
     38         * it, that is possible via dynamic binding or overloading. 
     39         */ 
     40        virtual std::string GetRemoteComponentType(int32_t componentSocketFD) 
     41        { 
     42            SendMessage(componentSocketFD, "request_component_type"); 
     43 
     44            char buffer[256]; 
     45            memset(buffer, 0, 256); 
     46            ReadMessage(componentSocketFD, buffer); 
     47 
     48            return std::string(buffer); 
     49        } 
    3850 
    3951