gtsam 4.1.1
gtsam
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
22#include <gtsam/inference/Key.h>
23
24#include <map>
25#include <string>
26#include <vector>
27
28namespace gtsam {
29
34 typedef std::pair<Key,size_t> DiscreteKey;
35
37 struct DiscreteKeys: public std::vector<DiscreteKey> {
38
41 }
42
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
64 push_back(key);
65 return *this;
66 }
67 }; // DiscreteKeys
68
70 GTSAM_EXPORT DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2);
71}
Included from all GTSAM files.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
DiscreteKeys operator&(const DiscreteKey &key1, const DiscreteKey &key2)
Create a list from two keys.
Definition: DiscreteKey.cpp:49
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
std::pair< Key, size_t > DiscreteKey
Key type for discrete conditionals Includes name and cardinality.
Definition: DiscreteKey.h:34
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:37
DiscreteKeys & operator&(const DiscreteKey &key)
Add a key (non-const!)
Definition: DiscreteKey.h:63
GTSAM_EXPORT KeyVector indices() const
Return a vector of indices.
Definition: DiscreteKey.cpp:34
GTSAM_EXPORT std::map< Key, size_t > cardinalities() const
Return a map from index to cardinality.
Definition: DiscreteKey.cpp:41
DiscreteKeys()
Default constructor.
Definition: DiscreteKey.h:40
DiscreteKeys(const DiscreteKey &key)
Construct from a key.
Definition: DiscreteKey.h:44
DiscreteKeys(const std::vector< DiscreteKey > &keys)
Construct from a vector of keys.
Definition: DiscreteKey.h:49