TopicSettings.cpp

Go to the documentation of this file.
00001 #include "TopicSettings.h"
00002 
00003 #include "ace/OS_NS_stdio.h"
00004 #include "ace/Log_Priority.h"
00005 #include "ace/Log_Msg.h"
00006 
00007 #include <cstring>
00008 
00009 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00010 
00011 namespace OpenDDS { namespace FaceTSS { namespace config {
00012 
00013 int
00014 TopicSettings::set(const char* name, const char* value)
00015 {
00016   int status = 0;
00017   if (!std::strcmp(name, "platform_view_guid")) {
00018     platform_view_guid_ = atoi(value);
00019   } else if (!std::strcmp(name, "max_message_size")) {
00020     max_message_size_ = atoi(value);
00021   } else if (!std::strcmp(name, "type_name")) {
00022     // Guarantee that value will fit in type_name_ and still be null terminated
00023     // type_name_ is sized to TYPE_NAME_LEN
00024     if (std::strlen(value) >= sizeof(type_name_)) {
00025       ACE_ERROR((LM_ERROR, ACE_TEXT("Type name %C exceeds allowable length,"
00026         "must be < %d \n"), value, TYPE_NAME_LEN));
00027       status = 1;
00028     } else {
00029       std::strncpy(type_name_, value, sizeof(type_name_));
00030     }
00031   } else {
00032     // no match
00033     ACE_ERROR((LM_ERROR, ACE_TEXT("Don't know of setting %C\n"), name));
00034     status = 1;
00035   }
00036 
00037   return status;
00038 }
00039 
00040 } } }
00041 
00042 OPENDDS_END_VERSIONED_NAMESPACE_DECL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1