#include <event-map.h>
Definition at line 269 of file event-map.h.
◆ ~SplitEventMap()
◆ SplitEventMap() [1/2]
This constructor takes ownership of the "yes" and "no" arguments.
Definition at line 319 of file event-map.h.
References kaldi::IsSorted(), KALDI_ASSERT, and KALDI_PARANOID_ASSERT.
#define KALDI_PARANOID_ASSERT(cond)
ConstIntegerSet< EventValueType > yes_set_
bool IsSorted(const std::vector< T > &vec)
Returns true if the vector is sorted.
#define KALDI_ASSERT(cond)
◆ SplitEventMap() [2/2]
This constructor used in the Copy() function.
Definition at line 328 of file event-map.h.
References KALDI_ASSERT.
ConstIntegerSet< EventValueType > yes_set_
#define KALDI_ASSERT(cond)
◆ Copy()
Implements EventMap.
Definition at line 303 of file event-map.h.
SplitEventMap(EventKeyType key, const std::vector< EventValueType > &yes_set, EventMap *yes, EventMap *no)
This constructor takes ownership of the "yes" and "no" arguments.
virtual EventMap * Copy(const std::vector< EventMap *> &new_leaves) const =0
ConstIntegerSet< EventValueType > yes_set_
◆ Destroy()
◆ GetChildren()
virtual void GetChildren |
( |
std::vector< EventMap *> * |
out | ) |
const |
|
inlinevirtual |
◆ Map()
Implements EventMap.
Definition at line 272 of file event-map.h.
279 return no_->
Map(event, ans);
virtual bool Map(const EventType &event, EventAnswerType *ans) const =0
ConstIntegerSet< EventValueType > yes_set_
static bool Lookup(const EventType &event, EventKeyType key, EventValueType *ans)
int32 EventValueType
Given current code, things of type EventValueType should generally be nonnegative and in a reasonably...
◆ MapValues()
Implements EventMap.
Definition at line 165 of file event-map.cc.
References ConstIntegerSet< I >::begin(), KALDI_ERR, EventMap::MapValues(), and kaldi::SortAndUniq().
171 if (keys_to_map.count(
key_) == 0) {
174 std::vector<EventValueType> yes_set;
179 unordered_map<EventValueType, EventValueType>::const_iterator
180 map_iter = value_map.find(value);
181 if (map_iter == value_map.end())
182 KALDI_ERR <<
"Value " << value <<
", for key " 183 <<
key_ <<
", cannot be mapped.";
185 yes_set.push_back(mapped_value);
void SortAndUniq(std::vector< T > *vec)
Sorts and uniq's (removes duplicates) from a vector.
SplitEventMap(EventKeyType key, const std::vector< EventValueType > &yes_set, EventMap *yes, EventMap *no)
This constructor takes ownership of the "yes" and "no" arguments.
virtual EventMap * MapValues(const unordered_set< EventKeyType > &keys_to_map, const unordered_map< EventValueType, EventValueType > &value_map) const =0
ConstIntegerSet< EventValueType > yes_set_
std::vector< EventValueType >::const_iterator iterator
int32 EventValueType
Given current code, things of type EventValueType should generally be nonnegative and in a reasonably...
◆ MultiMap()
Implements EventMap.
Definition at line 284 of file event-map.h.
ConstIntegerSet< EventValueType > yes_set_
static bool Lookup(const EventType &event, EventKeyType key, EventValueType *ans)
int32 EventValueType
Given current code, things of type EventValueType should generally be nonnegative and in a reasonably...
virtual void MultiMap(const EventType &event, std::vector< EventAnswerType > *ans) const =0
◆ operator=()
◆ Prune()
Implements EventMap.
Definition at line 156 of file event-map.cc.
References EventMap::Prune().
159 if (yes == NULL && no == NULL)
return NULL;
160 else if (yes == NULL)
return no;
161 else if (no == NULL)
return yes;
SplitEventMap(EventKeyType key, const std::vector< EventValueType > &yes_set, EventMap *yes, EventMap *no)
This constructor takes ownership of the "yes" and "no" arguments.
ConstIntegerSet< EventValueType > yes_set_
virtual EventMap * Prune() const =0
◆ Read()
Definition at line 209 of file event-map.cc.
References kaldi::ExpectToken(), KALDI_ERR, ConstIntegerSet< I >::Read(), EventMap::Read(), and kaldi::ReadBasicType().
Referenced by EventMap::Read().
215 ConstIntegerSet<EventValueType> yes_set;
216 yes_set.Read(is, binary);
223 if (yes == NULL || no == NULL)
KALDI_ERR <<
"SplitEventMap::Read, NULL pointers.";
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
static EventMap * Read(std::istream &is, bool binary)
a Read function that reads an arbitrary EventMap; also works for NULL pointers.
SplitEventMap(EventKeyType key, const std::vector< EventValueType > &yes_set, EventMap *yes, EventMap *no)
This constructor takes ownership of the "yes" and "no" arguments.
void ExpectToken(std::istream &is, bool binary, const char *token)
ExpectToken tries to read in the given token, and throws an exception on failure. ...
int32 EventKeyType
Things of type EventKeyType can take any value.
◆ Write()
void Write |
( |
std::ostream & |
os, |
|
|
bool |
binary |
|
) |
| |
|
virtual |
Write to stream.
Implements EventMap.
Definition at line 192 of file event-map.cc.
References KALDI_ASSERT, KALDI_ERR, kaldi::WriteBasicType(), and kaldi::WriteToken().
202 if (!binary) os <<
'\n';
204 KALDI_ERR <<
"SplitEventMap::Write(), could not write to stream.";
ConstIntegerSet< EventValueType > yes_set_
void Write(std::ostream &os, bool binary) const
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters.
#define KALDI_ASSERT(cond)
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
virtual void Write(std::ostream &os, bool binary)=0
Write to stream.
◆ key_
◆ no_
◆ yes_
◆ yes_set_
The documentation for this class was generated from the following files: