basix_doc 0.1
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.

                                                                              :
    ps (p2), names (n2) {}

Member Function Documentation

port accept ( ) [virtual, inherited]

Reimplemented in socket_port_rep.

Definition at line 87 of file port.cpp.

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

                  {
  mmerr << "port= " << expression () << lf;
  ERROR ("socket server port expected");
}
bool busy ( ) [inline, virtual]

Reimplemented from port_rep.

Definition at line 62 of file composite_port.cpp.

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

               {
    for (nat i=0; i<N(ps); i++)
      if (mmx::busy (ps[i]))
        return true;
    return false;
  }
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().

                  {
    nat r= 0;
    for (nat i=0; i<N(ps); i++)
      if (mmx::is_input_port (ps[i]))
        r += mmx::can_read (ps[i]);
    return r;
  }
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().

                   {
    nat r= (nat) (-1);
    for (nat i=0; i<N(ps); i++)
      if (mmx::is_output_port (ps[i]))
        r= min (r, mmx::can_write (ps[i]));
    return r;
  }
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().

                                      {
    for (nat i=0; i<N(ps); i++)
      if (name == names[i])
        return ps[i];
    ERROR ("port not found");
  }
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().

                     {
    for (nat i=0; i<N(ps); i++)
      if (mmx::error_flag (ps[i]))
        return true;
    return false;
  }
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().

                          {
    for (nat i=0; i<N(ps); i++)
      if (mmx::error_flag (ps[i]))
        return mmx::error_message (ps[i]);
    return "";
  }
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().

                                {
    vector<syntactic> v;
    for (nat i=0; i<N(ps); i++)
      v << syn (GEN_TYPE, syntactic (names[i]), flatten (ps[i]));
    return syn ("composite_port", v);
  }
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().

                {
    for (nat i=0; i<N(ps); i++)
      if (mmx::is_output_port (ps[i]))
        mmx::flush (ps[i]);
  }
void format ( const print_format fm) [virtual, inherited]

Reimplemented in formatting_port_rep.

Definition at line 99 of file port.cpp.

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

                                        {
  mmerr << "port= " << expression () << lf;
  ERROR ("formatting port expected");  
}
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().

                        {
    for (nat i=0; i<N(ps); i++)
      if (mmx::is_input_port (ps[i]))
        return true;
    return false;
  }
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().

                         {
    for (nat i=0; i<N(ps); i++)
      if (mmx::is_output_port (ps[i]))
        return true;
    return false;
  }
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().

                             {
    while (n > 0)
      for (nat i=0; i<N(ps); i++)
        if (n > 0 && mmx::is_input_port (ps[i])) {
          nat k= min (n, mmx::can_read (ps[i]));
          if (k > 0) mmx::read (ps[i], s, k);
          s += k;
          n -= k;
        }
    ASSERT (n == 0, "read failed");
  }
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().

                        {
    for (nat i=0; i<N(ps); i++)
      if (mmx::is_input_port (ps[i])) {
        nat delay= min (msecs, 1);
        if (mmx::wait (ps[i], delay)) return true;
        msecs -= delay;
      }
    return false;
  }
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().

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

Member Data Documentation

MMX_ALLOCATORS int ref_count [inherited]

Definition at line 138 of file basix.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines