OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
USBSerialEnum.cpp
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 // Internal Includes
27 #include "USBSerialEnumImpl.h"
28 
29 // Library/third-party includes
30 
31 // Standard includes
32 #include <memory>
33 #include <iostream>
34 
35 namespace osvr {
36 namespace usbserial {
37 
38  EnumeratorIterator::EnumeratorIterator(DeviceList const &devices,
39  std::size_t posn)
40  : devs(&devices), pos(posn){};
41 
42  EnumeratorIterator &EnumeratorIterator::operator++() {
43  if (pos < devs->size()) {
44  // range protection
45  ++pos;
46  }
47  return *this;
48  }
49  USBSerialDevice const &EnumeratorIterator::operator*() const {
50  return devs->at(pos);
51  }
52 
53  bool EnumeratorIterator::operator!=(const EnumeratorIterator &other) const {
54  return pos != other.pos || devs != other.devs;
55  }
56 
57  Enumerator::Enumerator(uint16_t vendorID, uint16_t productID)
58  : m_impl(new EnumeratorImpl(vendorID, productID)){};
59 
60  Enumerator::Enumerator() : m_impl(new EnumeratorImpl()){};
61  Enumerator::Enumerator(Enumerator &&other)
62  : m_impl(std::move(other.m_impl)) {}
63  Enumerator::~Enumerator() {}
64 
65  EnumeratorIterator Enumerator::begin() { return m_impl->begin(); }
66  EnumeratorIterator Enumerator::end() { return m_impl->end(); }
67 
68 } // namespace usbserial
69 } // namespace osvr
STL namespace.
detail::size< coerce_list< Ts...>> size
Get the size of a list (number of elements.)
Definition: Size.h:56
bool operator!=(const OSVR_TimeValue &tvA, const OSVR_TimeValue &tvB)
Operator == overload for time values.
Definition: TimeValueC.h:262