mirror of
https://github.com/JHUAPL/kami.git
synced 2026-01-08 14:33:53 -05:00
New documentation for Coord, Domain, and output function for Coord
This commit is contained in:
@@ -34,12 +34,30 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
/// \brief Provides an environment for the agents to participate in
|
||||
/**
|
||||
* Provides an environment for the agents to participate in. Implementations
|
||||
* of virtual environments are expected to subclass Domain.
|
||||
*/
|
||||
class LIBKAMI_EXPORT Domain {};
|
||||
|
||||
/**
|
||||
* Provides a coordinate system for each Domain. The coordinate system must
|
||||
* be able to produce a human-readable version of the coordinates given. For
|
||||
* instance, an integer grid in two dimensions would provide standard Descartes
|
||||
* coordinates like (0, 0) for the origin, or (2, 3) for the position that is
|
||||
* two units "up" and three units to the "right" of the origin.
|
||||
*/
|
||||
class LIBKAMI_EXPORT Coord {
|
||||
public:
|
||||
/**
|
||||
* Convert the coordinate to a human readable string.
|
||||
*/
|
||||
virtual std::string to_string() const = 0;
|
||||
|
||||
/**
|
||||
* Output an Coord to the specified output stream.
|
||||
*/
|
||||
friend std::ostream &operator<<(std::ostream &lhs, const Coord &rhs);
|
||||
};
|
||||
|
||||
} // namespace kami
|
||||
|
||||
@@ -9,6 +9,7 @@ create_library(NAME libkami
|
||||
NAMESPACE libkami
|
||||
SOURCES
|
||||
agent.cc
|
||||
domain.cc
|
||||
grid1d.cc
|
||||
grid2d.cc
|
||||
grid3d.cc
|
||||
|
||||
37
src/libkami/domain.cc
Normal file
37
src/libkami/domain.cc
Normal file
@@ -0,0 +1,37 @@
|
||||
/*-
|
||||
* Copyright (c) 2020 The Johns Hopkins University Applied Physics
|
||||
* Laboratory LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <kami/domain.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace kami {
|
||||
|
||||
std::ostream &operator<<(std::ostream &lhs, const Coord &rhs) {
|
||||
return lhs << rhs.to_string();
|
||||
}
|
||||
|
||||
} // namespace kami
|
||||
Reference in New Issue
Block a user