Botan  2.7.0
Crypto and TLS for C++11
basefilt.cpp
Go to the documentation of this file.
1 /*
2 * Basic Filters
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #include <botan/basefilt.h>
9 #include <botan/key_filt.h>
10 
11 namespace Botan {
12 
14  {
15  if(iv.length() != 0)
16  throw Invalid_IV_Length(name(), iv.length());
17  }
18 
19 /*
20 * Chain Constructor
21 */
22 Chain::Chain(Filter* f1, Filter* f2, Filter* f3, Filter* f4)
23  {
24  if(f1) { attach(f1); incr_owns(); }
25  if(f2) { attach(f2); incr_owns(); }
26  if(f3) { attach(f3); incr_owns(); }
27  if(f4) { attach(f4); incr_owns(); }
28  }
29 
30 /*
31 * Chain Constructor
32 */
33 Chain::Chain(Filter* filters[], size_t count)
34  {
35  for(size_t j = 0; j != count; ++j)
36  if(filters[j])
37  {
38  attach(filters[j]);
39  incr_owns();
40  }
41  }
42 
43 std::string Chain::name() const
44  {
45  return "Chain";
46  }
47 
48 /*
49 * Fork Constructor
50 */
51 Fork::Fork(Filter* f1, Filter* f2, Filter* f3, Filter* f4)
52  {
53  Filter* filters[4] = { f1, f2, f3, f4 };
54  set_next(filters, 4);
55  }
56 
57 /*
58 * Fork Constructor
59 */
60 Fork::Fork(Filter* filters[], size_t count)
61  {
62  set_next(filters, count);
63  }
64 
65 std::string Fork::name() const
66  {
67  return "Fork";
68  }
69 
70 }
void attach(Filter *f)
Definition: filter.h:164
std::string name() const override
Definition: basefilt.cpp:43
void set_next(Filter *f[], size_t n)
Definition: filter.h:162
virtual void set_iv(const InitializationVector &iv)
Definition: basefilt.cpp:13
Fork(Filter *, Filter *, Filter *=nullptr, Filter *=nullptr)
Definition: basefilt.cpp:51
Definition: alg_id.cpp:13
size_t length() const
Definition: symkey.h:25
virtual std::string name() const =0
std::string name() const override
Definition: basefilt.cpp:65
Chain(Filter *=nullptr, Filter *=nullptr, Filter *=nullptr, Filter *=nullptr)
Definition: basefilt.cpp:22