Isomet Modular Synthesiser (iMS) API  v1.4.2
iMS API
Containers.h
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------------
2 / Title : iMS Containers
3 / Project : Isomet Modular Synthesiser System
4 /------------------------------------------------------------------------------
5 / File : $URL: http://nutmeg.qytek.lan/svn/sw/trunk/09-Isomet/iMS_SDK/API/Other/h/Containers.h $
6 / Author : $Author: dave $
7 / Company : Isomet (UK) Ltd
8 / Created : 2016-10-01
9 / Last update: $Date: 2017-09-11 23:55:34 +0100 (Mon, 11 Sep 2017) $
10 / Platform :
11 / Standard : C++11
12 / Revision : $Rev: 300 $
13 /------------------------------------------------------------------------------
14 / Description:
15 /------------------------------------------------------------------------------
16 / Copyright (c) 2016 Isomet (UK) Ltd. All Rights Reserved.
17 /------------------------------------------------------------------------------
18 / Revisions :
19 / Date Version Author Description
20 / 2015-04-09 1.0 dc Created
21 /
22 /----------------------------------------------------------------------------*/
23 
34 
35 #ifndef IMS_CONTAINERS_H__
36 #define IMS_CONTAINERS_H__
37 
38 #include <deque>
39 #include <list>
40 #include <array>
41 #include <cstdint>
42 #include <ctime>
43 
45 #if defined _WIN32 || defined __CYGWIN__
46  #ifdef __GNUC__
47  #define DLL_EXPORT __attribute__ ((dllexport))
48  #define DLL_IMPORT __attribute__ ((dllimport))
49  #else
50  #define DLL_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
51  #define DLL_IMPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
52  #endif
53  #define DLL_LOCAL
54 #else
55  #if __GNUC__ >= 4
56  #define DLL_EXPORT __attribute__ ((visibility ("default")))
57  #define DLL_IMPORT __attribute__ ((visibility ("default")))
58  #define DLL_LOCAL __attribute__ ((visibility ("hidden")))
59  #else
60  #define DLL_EXPORT
61  #define DLL_IMPORT
62  #define DLL_LOCAL
63  #endif
64 #endif
65 
66 #if defined(_EXPORTING_IMS)
67  #define LIBSPEC DLL_EXPORT
68  #define LIBLOCAL DLL_LOCAL
69  #define EXPIMP_TEMPLATE
70 #elif defined(_STATIC_IMS)
71  #define LIBSPEC
72  #define LIBLOCAL
73  #define EXPIMP_TEMPLATE
74 #else
75  #define LIBSPEC DLL_IMPORT
76  #define LIBLOCAL DLL_LOCAL
77  #define EXPIMP_TEMPLATE extern
78 #endif
79 
81 namespace iMS {
82 
90  template <typename T>
91  class LIBSPEC ListBase
92  {
93  public:
95 
96  ListBase(const std::string& Name = "[no name]", const std::time_t& modified_time = std::time(nullptr));
99  ~ListBase();
101  ListBase(const ListBase &);
103  ListBase &operator =(const ListBase &);
105 
115 
116  typedef typename std::list<T>::iterator iterator;
119  typedef typename std::list<T>::const_iterator const_iterator;
122  iterator begin();
133  iterator end();
137  const_iterator begin() const;
141  const_iterator end() const;
144  const_iterator cbegin() const;
147  const_iterator cend() const;
149 
154  bool operator==(ListBase const& rhs) const;
155 
158 
159  const std::array<std::uint8_t, 16> GetUUID() const;
164 
168 
169  const std::time_t& ModifiedTime() const;
180  std::string ModifiedTimeFormat() const;
182 
186 
187  const std::string& Name() const;
192  std::string& Name();
194 
197 
198  void assign(size_t n, const T& val);
211  void push_front(const T& val);
216  void pop_front();
223  void push_back(const T& val);
228  void pop_back();
236  iterator insert(iterator position, const T& val);
247  iterator insert(iterator position, const_iterator first, const_iterator last);
254  iterator erase(iterator position);
262  iterator erase(iterator first, iterator last);
271  void resize(size_t n);
275  void clear();
277 
279 
280  bool empty() const;
285  std::size_t size() const;
287 
288  private:
289  class ListImpl;
290  ListImpl *p_ListImpl;
291  };
292 
293 
301  template <typename T>
302  class LIBSPEC DequeBase
303  {
304  public:
314 
315  typedef typename std::deque<T>::iterator iterator;
318  typedef typename std::deque<T>::const_iterator const_iterator;
321  iterator begin();
332  iterator end();
336  const_iterator begin() const;
340  const_iterator end() const;
343  const_iterator cbegin() const;
346  const_iterator cend() const;
348 
350 
351  DequeBase(const std::string& Name = "[no name]", const std::time_t& modified_time = std::time(nullptr));
354  ~DequeBase();
356  DequeBase(size_t, const T&, const std::string& Name = "[no name]", const std::time_t& modified_time = std::time(nullptr));
358  DequeBase(const_iterator first, const_iterator last, const std::string& Name = "[no name]", const std::time_t& modified_time = std::time(nullptr));
360  DequeBase(const DequeBase &);
362  DequeBase &operator =(const DequeBase &);
364 
367 
368  T& operator[](int idx);
385  const T& operator[](int idx) const;
387 
390 
391  bool operator==(DequeBase const& rhs) const;
406  const std::array<std::uint8_t, 16> GetUUID() const;
408 
412 
413  const std::time_t& ModifiedTime() const;
424  std::string ModifiedTimeFormat() const;
426 
430 
431  const std::string& Name() const;
436  std::string& Name();
438 
442  void clear();
443 
446  iterator insert(iterator pos, const T& value);
447 
449  iterator insert(const_iterator pos, size_t count, const T& value);
450 
452  iterator insert(iterator pos, const_iterator first, const_iterator last);
453 
455  void push_back(const T& value);
456 
458  void pop_back();
459 
461  void push_front(const T& value);
462 
464  void pop_front();
465 
467  iterator erase(iterator pos);
468 
470  iterator erase(iterator first, iterator last);
471 
473  std::size_t size() const;
474 
475  private:
476  class DequeImpl;
477  DequeImpl *p_DequeImpl;
478  };
479 
480 }
481 
482 #endif
Template Class encapsulating a list object and acting as a base list class for other classes in the l...
Definition: Containers.h:91
std::deque< T >::const_iterator const_iterator
Const Iterator defined for user readback of DequeBase.
Definition: Containers.h:318
std::list< T >::const_iterator const_iterator
Const Iterator defined for user readback of ListBase.
Definition: Containers.h:119
The entire API is encapsulated by the iMS namespace.
Definition: Auxiliary.h:95
Template Class encapsulating a deque object and acting as a base deque class for other classes in the...
Definition: Containers.h:302
std::list< T >::iterator iterator
Iterator defined for user manipulation of ListBase.
Definition: Containers.h:117
std::deque< T >::iterator iterator
Iterator defined for user manipulation of DequeBase.
Definition: Containers.h:316