strus  0.17
index.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_INDEX_HPP_INCLUDED
11 #define _STRUS_INDEX_HPP_INCLUDED
12 
13 #ifdef _MSC_VER
14 #pragma warning(disable:4290)
15 #include <BaseTsd.h>
16 namespace strus {
19  typedef INT32 Index;
22  typedef INT64 GlobalCounter;
23 }//namespace
24 #else
25 #include <stdint.h>
26 namespace strus {
29  typedef int32_t Index;
32  typedef int64_t GlobalCounter;
33 }//namespace
34 #endif
35 
36 namespace strus {
37 
39 {
40 public:
41  Index start() const
42  {
43  return m_start;
44  }
45  Index end() const
46  {
47  return m_end;
48  }
49  int len() const
50  {
51  return m_end - m_start;
52  }
53  bool defined() const
54  {
55  return m_start < m_end;
56  }
57 
59  :m_start(0),m_end(0){}
60  IndexRange( Index start_, Index end_)
61  :m_start(start_),m_end(end_){}
63  :m_start(o.m_start),m_end(o.m_end){}
64 
65 private:
66  Index m_start;
67  Index m_end;
68 };
69 
70 }//namespace
71 #endif
72 
IndexRange(Index start_, Index end_)
Definition: index.hpp:60
int32_t Index
Number type generally used for locally counted indices.
Definition: index.hpp:29
Definition: index.hpp:38
int len() const
Definition: index.hpp:49
bool defined() const
Definition: index.hpp:53
Index end() const
Definition: index.hpp:45
IndexRange()
Definition: index.hpp:58
IndexRange(const IndexRange &o)
Definition: index.hpp:62
int64_t GlobalCounter
Number type generally used for indices globally shared between different instances of strus...
Definition: index.hpp:32
Index start() const
Definition: index.hpp:41