# Triead reference

Triead is a class that can be referenced from multiple threads and inherits from Mtarget. It's defined in

    app/Triead.h

.

The meaning of the &Cpp; methods is exactly the same as in Perl, only the format of values is slightly different. Obviously, the

    start*()

methods are Perl-only, in &Cpp; the Trieads are defined by

    App::makeTriead()

with the help of

    App::defineJoin()

.

    const string &getName() const;

Get the Triead's name.

    const string &fragment() const;

Get the name of the Triead's fragment. If the Triead doesn't belong to a fragment, returns an empty string .

    bool isConstructed() const;

Check whether the Triead has been constructed. For the explanation of the Triead lifecycle states, see &xrsp;.

    bool isReady() const;

Check whether the Triead is ready.

    bool isDead() const;

Check whether the Triead is dead.

    bool isInputOnly() const;

Check whether the Triead is input-only, that is, it has no reader nexuses imported into it. When the Triead is created, this flag starts its life as

    false

, and then its correct value is computed when the Triead becomes ready. So, to check this flag correctly, you must first check that the Triead is ready.

    typedef map > NexusMap;
    void exports(NexusMap &ret) const;
    void imports(NexusMap &ret) const;
    void readerImports(NexusMap &ret) const;
    void writerImports(NexusMap &ret) const;

Get the list of nexuses exported from this Triead, or imported, or only the reader imports, or only the writer imports. In the result of

    imports()

there is no way to tell, which nexuses are imported for reading and which for writing, use the specialized methods for that. In all these methods the argument map gets cleared and then filled with the new returned contents.

    Onceref findNexus(const string &srcName,
    	const string &appName, const string &name) const;

This is a method unique to the &Cpp; API. It looks up an exported nexus by name without involving the overhead of getting the whole map. Here

    name

is the name of the nexus to look up (its short part, without the thread's name in it). If there is no such nexus, an Exception will be thrown.

The

    srcName

and

    appName

are used for the error message in the Exception:

    srcName

is the name of the thread that requested the look-up, and

    appName

is the name of the App where the threads belong. (It might seem surprising, but a Triead object has no reference to its App, and doesn't know the App's name. It has to do with the avoidance of the circular references).
Triead