DiscreteKey.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
21 #include <gtsam/global_includes.h>
22 #include <gtsam/inference/Key.h>
23 
24 #include <map>
25 #include <string>
26 #include <vector>
27 
28 namespace gtsam {
29 
34  typedef std::pair<Key,size_t> DiscreteKey;
35 
37  struct DiscreteKeys: public std::vector<DiscreteKey> {
38 
41  }
42 
44  DiscreteKeys(const DiscreteKey& key) {
45  push_back(key);
46  }
47 
49  DiscreteKeys(const std::vector<DiscreteKey>& keys) :
50  std::vector<DiscreteKey>(keys) {
51  }
52 
54  GTSAM_EXPORT DiscreteKeys(const std::vector<int>& cs);
55 
57  GTSAM_EXPORT KeyVector indices() const;
58 
60  GTSAM_EXPORT std::map<Key,size_t> cardinalities() const;
61 
63  DiscreteKeys& operator&(const DiscreteKey& key) {
64  push_back(key);
65  return *this;
66  }
67  }; // DiscreteKeys
68 
70  GTSAM_EXPORT DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2);
71 }
DiscreteKeys()
Default constructor.
Definition: DiscreteKey.h:40
GTSAM_EXPORT KeyVector indices() const
Return a vector of indices.
Definition: DiscreteKey.cpp:34
DiscreteKeys & operator&(const DiscreteKey &key)
Add a key (non-const!)
Definition: DiscreteKey.h:63
Definition: Half.h:150
Included from all GTSAM files.
const Symbol key1('v', 1)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:34
GTSAM_EXPORT std::map< Key, size_t > cardinalities() const
Return a map from index to cardinality.
Definition: DiscreteKey.cpp:41
traits
Definition: chartTesting.h:28
DiscreteKeys(const std::vector< DiscreteKey > &keys)
Construct from a vector of keys.
Definition: DiscreteKey.h:49
const Symbol key2('v', 2)
DiscreteKeys(const DiscreteKey &key)
Construct from a key.
Definition: DiscreteKey.h:44
const KeyVector keys
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:37


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:59