Atoms Crowd  4.1.0
Locomotions.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <Atoms/Globals.h>
11 #include <Atoms/Locomotion.h>
12 #include <map>
13 #include <vector>
14 #include <functional>
15 #include <mutex>
16 
17 namespace Atoms
18 {
20 
22  class ATOMS_EXPORT Locomotions
23  {
24  public:
25 
27  static Locomotions& instance();
28 
30 
34  LocomotionCPtr locomotion(const std::string& name) const;
35 
37 
41  LocomotionPtr locomotion(const std::string& name);
42 
44 
48  void addLocomotion(const std::string& name, const Atoms::Locomotion& locomotion, bool replace = true);
49 
51 
55  void addLocomotion(const std::string& name, LocomotionPtr& locomotionPtr, bool replace = true);
56 
58 
61  void removeLocomotion(const std::string& name);
62 
64 
67  std::vector<std::string> locomotionNames();
68 
70 
74  bool locomotionExists(const std::string& name);
75 
77  unsigned int numLocomotions();
78 
80  void clear();
81 
82  private:
83 
85  Locomotions();
86 
88  Locomotions(const Locomotions&);
89 
91  ~Locomotions();
92 
94  Locomotions& operator=(const Locomotions&);
95 
96  typedef std::map<std::string, LocomotionPtr> LocomotionsMap;
97 
99 
102  LocomotionsMap m_locomotionsMap;
103 
104  mutable std::mutex m_mutex;
105  };
106 }
Atoms::Locomotions::locomotionNames
std::vector< std::string > locomotionNames()
Get all locomotion names.
Atoms::Locomotions::clear
void clear()
Remove all locomotions.
Atoms::Locomotion
Animation clip.
Definition: Locomotion.h:33
Atoms::Locomotions::instance
static Locomotions & instance()
Singleton access.
Atoms::Locomotions::addLocomotion
void addLocomotion(const std::string &name, LocomotionPtr &locomotionPtr, bool replace=true)
Add a locomotion to the map.
Atoms::Locomotions::addLocomotion
void addLocomotion(const std::string &name, const Atoms::Locomotion &locomotion, bool replace=true)
Add a locomotion to the map.
Atoms::Locomotions::locomotion
LocomotionCPtr locomotion(const std::string &name) const
Return a locomotion.
Atoms::Locomotions::removeLocomotion
void removeLocomotion(const std::string &name)
Remove a locomotion from the map.
Atoms::Locomotions::numLocomotions
unsigned int numLocomotions()
Get number of locomotions.
Atoms::Locomotions::locomotionExists
bool locomotionExists(const std::string &name)
Check if a locomotion exists.
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::Locomotions
Locomotions manager.
Definition: Locomotions.h:23
Atoms::LocomotionPtr
AtomsPtr< Locomotion > LocomotionPtr
locomotion pointer
Definition: Locomotion.h:80
Atoms::Locomotions::locomotion
LocomotionPtr locomotion(const std::string &name)
Return a locomotion.
Atoms::LocomotionCPtr
AtomsPtr< const Locomotion > LocomotionCPtr
locomotion const pointer
Definition: Locomotion.h:82