composite_port_rep Class Reference

Inheritance diagram for composite_port_rep:
port_rep rep_struct

List of all members.

Public Member Functions

Public Attributes


Detailed Description

Definition at line 26 of file composite_port.cpp.


Constructor & Destructor Documentation

composite_port_rep ( const vector< port > &  p2,
const vector< string > &  n2 
) [inline]

Definition at line 120 of file composite_port.cpp.

00120                                                                               :
00121     ps (p2), names (n2) {}
};


Member Function Documentation

port accept (  )  [virtual, inherited]

Reimplemented in socket_port_rep.

Definition at line 88 of file port.cpp.

References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.

00088                   {
00089   mmerr << "port= " << expression () << lf;
00090   ERROR ("socket server port expected");
00091 }

bool busy (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 62 of file composite_port.cpp.

References mmx::busy(), and mmx::N().

00062                {
00063     for (nat i=0; i<N(ps); i++)
00064       if (mmx::busy (ps[i]))
00065         return true;
00066     return false;
00067   }

nat can_read (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 75 of file composite_port.cpp.

References mmx::can_read(), mmx::is_input_port(), and mmx::N().

00075                   {
00076     nat r= 0;
00077     for (nat i=0; i<N(ps); i++)
00078       if (mmx::is_input_port (ps[i]))
00079         r += mmx::can_read (ps[i]);
00080     return r;
00081   }

nat can_write (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 68 of file composite_port.cpp.

References mmx::can_write(), mmx::is_output_port(), mmx::min(), and mmx::N().

00068                    {
00069     nat r= (nat) (-1);
00070     for (nat i=0; i<N(ps); i++)
00071       if (mmx::is_output_port (ps[i]))
00072         r= min (r, mmx::can_write (ps[i]));
00073     return r;
00074   }

port component ( const string name  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 112 of file composite_port.cpp.

References ERROR, and mmx::N().

00112                                       {
00113     for (nat i=0; i<N(ps); i++)
00114       if (name == names[i])
00115         return ps[i];
00116     ERROR ("port not found");
00117   }

bool error_flag (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 50 of file composite_port.cpp.

References mmx::error_flag(), and mmx::N().

00050                      {
00051     for (nat i=0; i<N(ps); i++)
00052       if (mmx::error_flag (ps[i]))
00053         return true;
00054     return false;
00055   }

string error_message (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 56 of file composite_port.cpp.

References mmx::error_flag(), mmx::error_message(), and mmx::N().

00056                           {
00057     for (nat i=0; i<N(ps); i++)
00058       if (mmx::error_flag (ps[i]))
00059         return mmx::error_message (ps[i]);
00060     return "";
00061   }

syntactic expression (  )  const [inline, virtual]

Implements port_rep.

Definition at line 31 of file composite_port.cpp.

References mmx::flatten(), mmx::GEN_TYPE, mmx::N(), and mmx::syn().

00031                                 {
00032     vector<syntactic> v;
00033     for (nat i=0; i<N(ps); i++)
00034       v << syn (GEN_TYPE, syntactic (names[i]), flatten (ps[i]));
00035     return syn ("composite_port", v);
00036   }

void flush (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 98 of file composite_port.cpp.

References mmx::flush(), mmx::is_output_port(), and mmx::N().

00098                 {
00099     for (nat i=0; i<N(ps); i++)
00100       if (mmx::is_output_port (ps[i]))
00101         mmx::flush (ps[i]);
00102   }

void format ( const print_format fm  )  [virtual, inherited]

Reimplemented in formatting_port_rep.

Definition at line 100 of file port.cpp.

References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.

00100                                         {
00101   mmerr << "port= " << expression () << lf;
00102   ERROR ("formatting port expected");  
00103 }

bool is_input_port (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 44 of file composite_port.cpp.

References mmx::is_input_port(), and mmx::N().

00044                         {
00045     for (nat i=0; i<N(ps); i++)
00046       if (mmx::is_input_port (ps[i]))
00047         return true;
00048     return false;
00049   }

bool is_output_port (  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 38 of file composite_port.cpp.

References mmx::is_output_port(), and mmx::N().

00038                          {
00039     for (nat i=0; i<N(ps); i++)
00040       if (mmx::is_output_port (ps[i]))
00041         return true;
00042     return false;
00043   }

void read ( char *  s,
nat  n 
) [inline, virtual]

Reimplemented from port_rep.

Definition at line 87 of file composite_port.cpp.

References ASSERT, mmx::can_read(), mmx::is_input_port(), mmx::min(), and mmx::N().

00087                              {
00088     while (n > 0)
00089       for (nat i=0; i<N(ps); i++)
00090         if (n > 0 && mmx::is_input_port (ps[i])) {
00091           nat k= min (n, mmx::can_read (ps[i]));
00092           if (k > 0) mmx::read (ps[i], s, k);
00093           s += k;
00094           n -= k;
00095         }
00096     ASSERT (n == 0, "read failed");
00097   }

bool wait ( int  msecs  )  [inline, virtual]

Reimplemented from port_rep.

Definition at line 103 of file composite_port.cpp.

References mmx::is_input_port(), mmx::min(), mmx::N(), and mmx::wait().

00103                         {
00104     for (nat i=0; i<N(ps); i++)
00105       if (mmx::is_input_port (ps[i])) {
00106         nat delay= min (msecs, 1);
00107         if (mmx::wait (ps[i], delay)) return true;
00108         msecs -= delay;
00109       }
00110     return false;
00111   }

void write ( const char *  s,
nat  n 
) [inline, virtual]

Reimplemented from port_rep.

Definition at line 82 of file composite_port.cpp.

References mmx::is_output_port(), mmx::N(), and mmx::write().

00082                                     {
00083     for (nat i=0; i<N(ps); i++)
00084       if (mmx::is_output_port (ps[i]))
00085         mmx::write (ps[i], s, n);
00086   }


Member Data Documentation

MMX_ALLOCATORS int ref_count [inherited]

Definition at line 164 of file basix.hpp.


The documentation for this class was generated from the following file:

Generated on 6 Dec 2012 for basix by  doxygen 1.6.1