parameters: (self, name, data_class, reg_type)
docstring: @param name: graph resource name of topic, e.g. 'laser'. 
          @type  name: str
          @param data_class: message class for serialization
          @type  data_class: L{Message}
          @param reg_type Registration.PUB or Registration.SUB
          @type  reg_type: str
          @raise ValueError: if parameters are invalid
function: def __init__(self, name, data_class, reg_type):
          """
          @param name: graph resource name of topic, e.g. 'laser'. 
          @type  name: str
          @param data_class: message class for serialization
          @type  data_class: L{Message}
          @param reg_type Registration.PUB or Registration.SUB
          @type  reg_type: str
          @raise ValueError: if parameters are invalid
          """
  
          if not name or not isstring(name):
              raise ValueError("topic name is not a non-empty string")
          try:
              if python3 == 1:
                  name.encode("utf-8")
              else: 
                  name = name.encode("utf-8")
          except UnicodeError:
              raise ValueError("topic name must be ascii/utf-8 compatible")
          if data_class is None:
              raise ValueError("topic parameter 'data_class' is not initialized")
          if not type(data_class) == type and not issubclass(data_class, google.protobuf.message.Message):
              raise ValueError("data_class [%s] is not a class"%data_class) 
          if not issubclass(data_class, genpy.Message) and not issubclass(data_class, google.protobuf.message.Message):
              raise ValueError("data_class [%s] is not a message data class"%data_class.__class__.__name__)
          # #2202
          if not rosgraph.names.is_legal_name(name):
              import warnings
              warnings.warn("'%s' is not a legal ROS graph resource name. This may cause problems with other ROS tools"%name, stacklevel=2)
          
          # this is a bit ugly, but necessary due to the fact that we allow
          # topics and services to be initialized before the node
          if not rospy.core.is_initialized():
              self.resolved_name = rospy.names.resolve_name_without_node_name(name)
          else:
              # init_node() has been called, so we can do normal resolution
              self.resolved_name = resolve_name(name)
  
          self.name = self.resolved_name # #1810 for backwards compatibility
  
          roslib.message.add_rosmsg_interface_for_protobuf(data_class)
          self.data_class = data_class
          self.type = data_class._type
          self.md5sum = data_class._md5sum
          self.reg_type = reg_type
          self.impl = get_topic_manager().acquire_impl(reg_type, self.resolved_name, data_class)
function_tokens: def __init__ ( self , name , data_class , reg_type ) : if not name or not isstring ( name ) : raise ValueError ( "topic name is not a non-empty string" ) try : if python3 == 1 : name . encode ( "utf-8" ) else : name = name . encode ( "utf-8" ) except UnicodeError : raise ValueError ( "topic name must be ascii/utf-8 compatible" ) if data_class is None : raise ValueError ( "topic parameter 'data_class' is not initialized" ) if not type ( data_class ) == type and not issubclass ( data_class , google . protobuf . message . Message ) : raise ValueError ( "data_class [%s] is not a class" % data_class ) if not issubclass ( data_class , genpy . Message ) and not issubclass ( data_class , google . protobuf . message . Message ) : raise ValueError ( "data_class [%s] is not a message data class" % data_class . __class__ . __name__ ) # #2202 if not rosgraph . names . is_legal_name ( name ) : import warnings warnings . warn ( "'%s' is not a legal ROS graph resource name. This may cause problems with other ROS tools" % name , stacklevel = 2 ) # this is a bit ugly, but necessary due to the fact that we allow # topics and services to be initialized before the node if not rospy . core . is_initialized ( ) : self . resolved_name = rospy . names . resolve_name_without_node_name ( name ) else : # init_node() has been called, so we can do normal resolution self . resolved_name = resolve_name ( name ) self . name = self . resolved_name # #1810 for backwards compatibility roslib . message . add_rosmsg_interface_for_protobuf ( data_class ) self . data_class = data_class self . type = data_class . _type self . md5sum = data_class . _md5sum self . reg_type = reg_type self . impl = get_topic_manager ( ) . acquire_impl ( reg_type , self . resolved_name , data_class )