Main Page · Modules · All Classes · Class Hierarchy
MASkitDatabase.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include "MASkit.hpp"
25 
26 #include "core/MACoreTypes.hpp"
27 
28 #include <MCThreadLocalData.hpp>
29 
30 #include <string>
31 #include <vector>
32 
33 class MASkitDatabase;
34 
35 namespace MA
36 {
38 extern MCThreadLocalData<MASkitDatabase> SkitDatabase;
40 static const std::string SkitNamePrefix = "SKIT:";
41 
43 typedef std::vector<SkitSPtr> SkitPtrList;
44 }
45 
55 {
56 public:
64  void AddSkit(MA::SkitSPtr skit);
65 
75  MA::SkitSPtr GetSkit(const std::string& name);
76 
85  void MirrorSkit(const std::string& name, const std::string& mirrored_name);
86 
94  void RemoveSkit(const std::string& name);
95 
101  void CreateMirroredSkits();
102 
115  static bool SaveToFile(const std::string& file_name, const MA::BinaryDataSPtrList& skits);
116 
126  static MASkitDatabase* LoadFromFile(const std::string& file_name);
127 
128 private:
130  MA::SkitPtrList Skits;
131 };
132 
MA::SkitPtrList Skits
Skits.
Skit database class.
A wrapper class to cover boost::thread_specific_ptr/folly::ThreadLocal API on certain targets...