Added documentation.

This commit is contained in:
Nicolás Ortega Froysa 2018-09-04 15:57:52 +02:00
parent 15067ab4ec
commit 04388c04b8
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 48 additions and 6 deletions

View File

@ -28,18 +28,24 @@ namespace neocomm {
class channel { class channel {
public: public:
/**
* @brief Initialize a channel object (this should pretty
* much only be done by the node object).
*
* @param name Name of the channel.
* @param network A pointer to the OpenDHT node.
*/
channel(const std::string &name, dht::DhtRunner *network); channel(const std::string &name, dht::DhtRunner *network);
~channel(); ~channel();
/**
* @brief Get the name of the channel.
*
* @return The name of the channel.
*/
inline std::string get_name() const { inline std::string get_name() const {
return name; return name;
} }
//inline dht::InfoHash get_key() const {
//return key;
//}
//inline size_t get_token() {
//return token.get();
//}
private: private:
const std::string name; const std::string name;

View File

@ -64,9 +64,45 @@ public:
*/ */
void export_nodes(const std::string &file_path); // TODO void export_nodes(const std::string &file_path); // TODO
/**
* @brief Join a channel.
*
* @param name Name of the channel.
*
* @note If the channel is already joined on this node
* then it does nothing and returns a nullptr.
*
* @return Returns a pointer to the channel object.
*/
channel *join_channel(const std::string &name); channel *join_channel(const std::string &name);
/**
* @brief Get a pointer to a channel object by name.
*
* @param name The name of the channel.
*
* @note If the channel has not been joined on this node
* then it returns nullptr.
*
* @return A pointer to the channel object.
*/
channel *get_channel(const std::string &name); channel *get_channel(const std::string &name);
/**
* @brief Leave a channel by name.
*
* @note If the channel has not been joined on this node
* it does nothing.
*
* @param name The name of the channel.
*/
void leave_channel(const std::string &name); void leave_channel(const std::string &name);
/**
* @brief Leave a channel by pointer to the object.
*
* @note If the channel has not been joined on this node
* it does nothing.
*
* @param chan The channel object.
*/
inline void leave_channel(channel *chan) { inline void leave_channel(channel *chan) {
leave_channel(chan->get_name()); leave_channel(chan->get_name());
} }