00001 #ifndef BLOCK_H
00002 #define BLOCK_H
00003
00004 #include "SundanceDefs.h"
00005 #include "Expr.h"
00006 #include "TSFVectorType.h"
00007 #include "Defaults.h"
00008
00009 namespace Sundance
00010 {
00011 using namespace TSF;
00012
00013
00014
00015
00016
00017 class Block
00018 {
00019 public:
00020
00021 Block();
00022
00023
00024 Block(const Expr& functions,
00025 const TSFVectorType& factory = Defaults::vectorType());
00026
00027
00028 Block(const Expr& f1, const Expr& f2,
00029 const TSFVectorType& factory = Defaults::vectorType() );
00030
00031
00032 Block(const Expr& f1, const Expr& f2, const Expr& f3,
00033 const TSFVectorType& factory = Defaults::vectorType() );
00034
00035
00036 Block(const Expr& f1, const Expr& f2, const Expr& f3, const Expr& f4,
00037 const TSFVectorType& factory = Defaults::vectorType());
00038
00039
00040 const Expr& functions() const {return functions_;}
00041
00042 const TSFVectorType& vectorType() const {return factory_;}
00043
00044 bool isReplicatedBlock() const {return isReplicatedBlock_;}
00045 private:
00046 void init();
00047
00048 Expr functions_;
00049 TSFVectorType factory_;
00050 bool isReplicatedBlock_;
00051 };
00052
00053 inline TSFArray<Block> BlockList(const Block& block)
00054 {
00055 TSFArray<Block> rtn(1);
00056 rtn[0] = block;
00057 return rtn;
00058 }
00059
00060 inline TSFArray<Block> BlockList(const Block& block1, const Block& block2)
00061 {
00062 TSFArray<Block> rtn = BlockList(block1);
00063 rtn.append(block2);
00064 return rtn;
00065 }
00066
00067 inline TSFArray<Block> BlockList(const Block& block1, const Block& block2,
00068 const Block& block3)
00069 {
00070 TSFArray<Block> rtn = BlockList(block1, block2);
00071 rtn.append(block3);
00072 return rtn;
00073 }
00074
00075 inline TSFArray<Block> BlockList(const Block& block1, const Block& block2,
00076 const Block& block3, const Block& block4)
00077 {
00078 TSFArray<Block> rtn = BlockList(block1, block2, block3);
00079 rtn.append(block4);
00080 return rtn;
00081 }
00082
00083 }
00084
00085
00086 #endif