00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef PEEKABOT_PATH_IDENTIFIER_HH_INCLUDED
00012 #define PEEKABOT_PATH_IDENTIFIER_HH_INCLUDED
00013
00014
00015 #include <string>
00016 #include <stdexcept>
00017
00018 #include "Types.hh"
00019 #include "serialization/SerializationInterface.hh"
00020 #include "serialization/DeserializationInterface.hh"
00021
00022
00023 namespace peekabot
00024 {
00025 class SceneObject;
00026 class ServerExecutionContext;
00027
00036 class PathIdentifier
00037 {
00038 public:
00039 PathIdentifier() throw();
00040
00049 PathIdentifier(ObjectID parent_id, const std::string &rel_path)
00050 throw(std::runtime_error);
00051
00055 PathIdentifier(const std::string &path) throw(std::runtime_error);
00056
00060 PathIdentifier(ObjectID id) throw();
00061
00062 #ifdef __PEEKABOT_SERVER
00063 SceneObject *get_parent(ServerExecutionContext *context)
00064 const throw(std::runtime_error);
00065
00066 SceneObject *get_leaf(ServerExecutionContext *context)
00067 const throw(std::runtime_error);
00068
00069 std::string get_leaf_name(ServerExecutionContext *context)
00070 const throw(std::runtime_error);
00071 #endif
00072
00073
00074 ObjectID get_parent_id() const throw() { return m_parent_id; }
00075
00076 const std::string &get_path() const throw() { return m_path; }
00077
00078 void set_parent_id(ObjectID parent_id) throw()
00079 {
00080 m_parent_id = parent_id;
00081 }
00082
00083 void set_path(const std::string &path) throw() { m_path = path; }
00084
00085 private:
00086 ObjectID m_parent_id;
00087 std::string m_path;
00088 };
00089
00090 void save(
00091 SerializationInterface &ar, const PathIdentifier &path_ident);
00092
00093 void load(
00094 DeserializationInterface &ar, PathIdentifier &path_ident, int version);
00095 }
00096
00097
00098 #endif // PEEKABOT_PATH_IDENTIFIER_HH_INCLUDED