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 metadataTopicFromLevelLevelId(level_id): 00017 return construct(level_id,'map_metadata') 00018 00019 def levelIdFromLevelFrameId(frame_id): 00020 components = frame_id.split('/') 00021 assert len(components) == 3 and components[0] == '' and components[2] == 'map', "malformed frame id provided for obtaining level id" 00022 return components[1] 00023 00024 def levelIdFromLevelMapTopic(map_topic): 00025 return levelIdFromLevelFrameId(map_topic)