memgraph/api/resources/include.hpp.template
2015-10-11 20:59:27 +02:00

52 lines
1.3 KiB
Plaintext

/** @file include.hpp
* @brief Links all restful resources to the application
*
* This file is autogenerated by the python script link_resources.py
*
* YOU SHOULD NOT EDIT THIS FILE MANUALLY!
*
* well, only if you're editing the template file, that's ok :)
*/
#ifndef MEMGRAPH_API_RESOURCES_INCLUDE_HPP
#define MEMGRAPH_API_RESOURCES_INCLUDE_HPP
#include <list>
#include <memory>
#include "utils/ioc/container.hpp"
#include "api/restful/resource.hpp"
#include "transactions/engine.hpp"
#include "threading/task.hpp"
#include "speedy/speedy.hpp"
// for each file in this folder a script will generate an include directive if
// this file contains any resources
// e.g.
// #include "node.hpp"
// #include "relationship.hpp"
<INCLUDE>
template <class T>
void insert(ioc::Container& container, const std::string& path)
{
auto app = container.resolve<sp::Speedy>();
auto resource = container.singleton<T, Task, Db>();
resource->link(*app, path);
}
void init(ioc::Container& container)
{
// for each resource in a file included above, the script will generate a
// linkage command call to the function above
// e.g.
// insert<CLASS>(PATH);
//
// insert<Nodes>("/node");
// insert<Node>("/node/{id:\\d+}");
<INIT>
}
#endif