00001 #!/usr/bin/env python 00002 00003 def construct(level_id, suffix): 00004 assert '/' not in level_id, "level id cannot contain forward slash" 00005 return level_id + '/' + suffix 00006 00007 def deconstruct(level_id, suffix): 00008 pass 00009 00010 def frameIdFromLevelId(level_id): 00011 return construct(level_id,'map') 00012 00013 def mapTopicFromLevelId(level_id): 00014 return construct(level_id,'map') 00015 00016 def metadataTopicFromLevelId(level_id): 00017 return construct(level_id,'map_metadata') 00018 00019 def mapServiceFromLevelId(level_id): 00020 return construct(level_id,'static_map') 00021 00022 def levelIdFromLevelFrameId(frame_id): 00023 components = frame_id.split('/') 00024 assert len(components) == 2 and components[1] == 'map', "malformed frame id provided for obtaining level id" 00025 return components[0] 00026 00027 def levelIdFromLevelMapTopic(map_topic): 00028 return levelIdFromLevelFrameId(map_topic)