Changeset 190

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'.

Location:
vtcross/trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/include/vtcross/Makefile.am

    r161 r190  
    11include_HEADERS = error.h debug.h socketcomm.h cbr.h components.h \ 
    22                                  containers.h libvtcross.h common.h config.h 
     3 
     4components_h_LDADD = ../lib/socketcomm/libsocketcomm.a 
  • 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 
  • vtcross/trunk/src/lib/socketcomm/socketcomm.cpp

    r189 r190  
    4646 
    4747int32_t  
    48 ClientSocket(const char* serverName, const char* portNumber) 
     48ClientSocket(const char* serverName, const char* serverPort) 
    4949{ 
    5050    int32_t socketFD; 
     
    5858        ERROR(1, "No server found by that hostname."); 
    5959 
    60     portNumber = atoi(portNumber); 
     60    portNumber = atoi(serverPort); 
    6161 
    6262    socketFD = socket(AF_INET, SOCK_STREAM, 0);