Botan  1.11.15
src/lib/filters/basefilt.cpp
Go to the documentation of this file.
00001 /*
00002 * Basic Filters
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #include <botan/basefilt.h>
00009 #include <botan/key_filt.h>
00010 
00011 namespace Botan {
00012 
00013 void Keyed_Filter::set_iv(const InitializationVector& iv)
00014    {
00015    if(iv.length() != 0)
00016       throw Invalid_IV_Length(name(), iv.length());
00017    }
00018 
00019 /*
00020 * Chain Constructor
00021 */
00022 Chain::Chain(Filter* f1, Filter* f2, Filter* f3, Filter* f4)
00023    {
00024    if(f1) { attach(f1); incr_owns(); }
00025    if(f2) { attach(f2); incr_owns(); }
00026    if(f3) { attach(f3); incr_owns(); }
00027    if(f4) { attach(f4); incr_owns(); }
00028    }
00029 
00030 /*
00031 * Chain Constructor
00032 */
00033 Chain::Chain(Filter* filters[], size_t count)
00034    {
00035    for(size_t j = 0; j != count; ++j)
00036       if(filters[j])
00037          {
00038          attach(filters[j]);
00039          incr_owns();
00040          }
00041    }
00042 
00043 std::string Chain::name() const
00044    {
00045    return "Chain";
00046    }
00047 
00048 /*
00049 * Fork Constructor
00050 */
00051 Fork::Fork(Filter* f1, Filter* f2, Filter* f3, Filter* f4)
00052    {
00053    Filter* filters[4] = { f1, f2, f3, f4 };
00054    set_next(filters, 4);
00055    }
00056 
00057 /*
00058 * Fork Constructor
00059 */
00060 Fork::Fork(Filter* filters[], size_t count)
00061    {
00062    set_next(filters, count);
00063    }
00064 
00065 std::string Fork::name() const
00066    {
00067    return "Fork";
00068    }
00069 
00070 }