Share

Annotate your header file

You can find the complete header file at the end of this section.

Any operator you create that you want used in a Bifrost graph needs to be annotated.

Annotations are passed to AMINO_ANNOTATE in the operator's header files, and are used to create a Bifrost definition JSON file that describes bindings between your C++ code and the underlying Amino API. The definition JSON file is then used by the Amino runtime to instantiate the defined nodes and ports.

Your operator can only be instantiated in a Bifrost graph if it has been annotated.

An operator only needs to have its node annotated with AMINO_ANNOTATE("Amino::Node") for it to be instantiated in a Bifrost graph. Other annotations can be added to create a port from a return value, define input/output parameters, or define custom types. However, for the purpose of this walkthrough, we will only be annotating the node.

The node annotation is added after the function's prototype statement, before the final semicolon (;):

SIMPLE_STRING_DECL
void join_strings(const Amino::String& first_string,
                  const Amino::String& second_string,
                  Amino::String& concatenated)
  AMINO_ANNOTATE("Amino::Node");
SIMPLE_STRING_DECL
void integer_to_string(int original_int, Amino::String& string_from_int)
  AMINO_ANNOTATE("Amino::Node");

The node that is instantiated in the Bifrost graph will have the same name as the function that defines it, and its ports will have the same names as the parameters passed to the function.

Continue to writing your macro definitions.

The complete header file

#ifndef SIMPLE_STRING_H
#define SIMPLE_STRING_H

#include "SimpleStringExport.h"

#include <Amino/Core/String.h>
#include <Amino/Cpp/Annotate.h>

namespace Examples {
namespace SDK {

//------------------------------------------------------------------------------
//
///
SIMPLE_STRING_DECL
void join_strings (const Amino::String& first_string,
                   const Amino::String& second_string,
                   Amino::String& concatenated)
    AMINO_ANNOTATE("Amino::Node");

//------------------------------------------------------------------------------
//
///
SIMPLE_STRING_DECL
void integer_to_string(int original_int, Amino::String& string_from_int)
    AMINO_ANNOTATE("Amino::Node");

} // namespace SDK
} // namespace Examples

#endif // SIMPLE_STRING_H

Was this information helpful?