| 51 | const Commands Foo::cmds = {}; |
| 52 | |
| 53 | Module *create_foo(const std::string name = "") { |
| 54 | const ModuleBuilder &builder = |
| 55 | ModuleBuilder::all_module_builders().find("Foo")->second; |
| 56 | |
| 57 | Module *m; |
| 58 | pb_error_t perr; |
| 59 | |
| 60 | bess::pb::EmptyArg arg_; |
| 61 | google::protobuf::Any arg; |
| 62 | arg.PackFrom(arg_); |
| 63 | |
| 64 | if (name.size() == 0) { |
| 65 | const std::string &mod_name = ModuleGraph::GenerateDefaultName( |
| 66 | builder.class_name(), builder.name_template()); |
| 67 | m = ModuleGraph::CreateModule(builder, mod_name, arg, &perr); |
| 68 | } else { |
| 69 | m = ModuleGraph::CreateModule(builder, name, arg, &perr); |
| 70 | } |
| 71 | |
| 72 | return m; |
| 73 | } |
| 74 | |
| 75 | DEF_MODULE(Foo, "foo", "bip"); |
| 76 | |