Skip to content

Commit

Permalink
Merge pull request #10 from mROS-base/mod_args
Browse files Browse the repository at this point in the history
fix arguments of mros2 APIs and reorder definitions into source code
  • Loading branch information
takasehideki authored Sep 12, 2021
2 parents 9fb8adf + 375eae4 commit c5ffe95
Show file tree
Hide file tree
Showing 2 changed files with 208 additions and 175 deletions.
86 changes: 46 additions & 40 deletions include/mros2.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,54 @@
#include "lwip.h"
#include "mros2/logging.h"

// To avoid link error
/* Statement to avoid link error */
#ifdef __cplusplus
extern void* __dso_handle;
#endif

namespace mros2
{

class Subscriber
void init(int argc, char * argv[]);

#ifdef __cplusplus
extern "C" {
#endif
void mros2_init(void *arg);
#ifdef __cplusplus
}
#endif

class Node;
class Publisher;
class Subscriber;

/* TODO: move to node.h/cpp? */
class Node
{
public:
std::string topic_name;
static void callback_handler(
void* callee,
const rtps::ReaderCacheChange& cacheChange
static Node create_node(
std::string node_name
);
void (*cb_fp)(intptr_t);

template <class T>
Publisher create_publisher(
std::string topic_name,
int qos
);

template <class T>
Subscriber create_subscription(
std::string topic_name,
int qos,
void (*fp)(T)
);

std::string node_name;
rtps::Participant* part;

private:

};

class Publisher
Expand All @@ -34,52 +64,28 @@ class Publisher
void publish(T& msg);
};

class Node//TODO: move to node.h/cpp?
class Subscriber
{
public:
static Node create_node();
template <class T>
Subscriber create_subscription(
std::string node_name,
int qos,
void (*fp)(T)
);
template <class T>
Publisher create_publisher(
std::string node_name,
int qos
std::string topic_name;
static void callback_handler(
void* callee,
const rtps::ReaderCacheChange& cacheChange
);
std::string node_name;
rtps::Participant* part;

void (*cb_fp)(intptr_t);
private:

};


void init(int argc, char *argv);
void spin();

void setTrue(void *args);
void setTrue(void *args);
void message_callback(void* callee, const rtps::ReaderCacheChange& cacheChange);
void message_callback(void* callee, const rtps::ReaderCacheChange& cacheChange);

#ifdef __cplusplus
extern "C" {
#endif
void mros2_init(void *arg);
#ifdef __cplusplus
}
#endif
}//namespace mros2
} /* namespace mros2 */

namespace message_traits
{
template <class T>
struct TypeName {
static const char* value();
};
}// namespace message_traits
#endif //MROS2_MROS2_H
} /* namespace message_traits */

#endif /* MROS2_MROS2_H */
Loading

0 comments on commit c5ffe95

Please sign in to comment.