@@ -59,6 +59,9 @@ struct ConnectionInfo {
5959 *
6060 * A NetworkConfig is needed whenever by network objects in order to establish
6161 * connections to other nodes.
62+ *
63+ * @see NetworkConfig::load
64+ * @see NetworkConfig::localhost
6265 */
6366class NetworkConfig {
6467 public:
@@ -76,7 +79,7 @@ class NetworkConfig {
7679 * 192.0.2.2, 5000
7780 * 192.0.2.3, 3000
7881 * $
79- * \endcode{.unparsed}
82+ * \endcode
8083 *
8184 * The order in which parties information occurs will correspond to their
8285 * identifier in the NetworkConfig that will be created.
@@ -90,21 +93,44 @@ class NetworkConfig {
9093 * assert(me.hostname == "192.0.2.2");
9194 * assert(me.port == 5000);
9295 * @endcode
96+ *
97+ * Minor validation is performed on the file.
98+ *
99+ * @throws std::invalid_argument if \p my_id is too large.
100+ * @throws std::invalid_argument if \p filename contains an invalid row.
101+ * @throws std::invalid_argument if \p filename could not be opened.
93102 */
94- static NetworkConfig load (std::size_t id , const std::string& filename);
103+ static NetworkConfig load (std::size_t my_id , const std::string& filename);
95104
96105 /* *
97106 * @brief Create a network config where all parties are running locally.
107+ *
108+ * Creates a network config of a specified size, where all parties have
109+ * addresses on this machine.
110+ *
111+ * @code
112+ * auto nc = NetworkConfig::localhost(3, 5, 5000);
113+ *
114+ * for (int i = 0; i < nc.networkSize(); i++) {
115+ * assert(nc.party(i).host == "127.0.0.1");
116+ * assert(nc.party(i).port == 5000 + i);
117+ * }
118+ * @endcode
119+ *
120+ * @throws std::invalid_argument if <code>my_id >= size</code>.
98121 */
99- static NetworkConfig localhost (std::size_t id ,
122+ static NetworkConfig localhost (std::size_t my_id ,
100123 std::size_t size,
101124 std::size_t port_base);
102125
103126 /* *
104127 * @brief Create a network config where all parties are running locally.
128+ *
129+ * Like \ref NetworkConfig::localhost with \ref DEFAULT_LOCALHOST_PORT_OFFSET
130+ * as \p port_base.
105131 */
106- static NetworkConfig localhost (std::size_t id , std::size_t size) {
107- return NetworkConfig::localhost (id , size, DEFAULT_LOCALHOST_PORT_OFFSET);
132+ static NetworkConfig localhost (std::size_t my_id , std::size_t size) {
133+ return NetworkConfig::localhost (my_id , size, DEFAULT_LOCALHOST_PORT_OFFSET);
108134 };
109135
110136 /* *
0 commit comments