Skip to content

Commit 46109aa

Browse files
konardclaude
andcommitted
Add comprehensive documentation comments to C++ code
Added detailed Doxygen-style comments to all major C++ header files: Core Interfaces and Types: - ILinks.h: Core interface for link management operations - LinkAddress.h: Link address wrapper with container semantics - LinksOptions.h: Configuration template for links system - LinksConstants.h: Essential constants and configuration values - Point.h: Point class for repeated link elements - WriteHandlerState.h: State management for write operations - ISynchronizedLinks.h: Thread-safe link operations interface - Platform.Data.h: Main library header with comprehensive overview Exception Classes: - ArgumentLinkDoesNotExistsException.h: Non-existent link references - ArgumentLinkHasDependenciesException.h: Links with dependencies - LinksLimitReachedException.h: Storage limit violations - LinksLimitReachedExceptionBase.h: Base for limit exceptions - LinkWithSameValueAlreadyExistsException.h: Duplicate link attempts All comments follow Doxygen conventions with: - File descriptions explaining purpose and functionality - Class/struct documentation with template parameters - Method documentation with parameters, returns, and exceptions - Member variable descriptions - Usage examples where appropriate 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 23320e3 commit 46109aa

13 files changed

Lines changed: 354 additions & 16 deletions
Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,48 @@
1-
namespace Platform::Data::Exceptions
1+
/// @file ArgumentLinkDoesNotExistsException.h
2+
/// @brief Exception thrown when a referenced link does not exist.
3+
4+
namespace Platform::Data::Exceptions
25
{
6+
/// @brief Generic template declaration for ArgumentLinkDoesNotExistsException.
37
template <typename ...> class ArgumentLinkDoesNotExistsException;
8+
9+
/// @brief Exception thrown when attempting to use a link address that doesn't exist.
10+
/// @tparam TLinkAddress The type used for link addressing.
11+
///
12+
/// This exception is thrown when operations reference a link that is not present
13+
/// in the storage system, indicating an invalid link address was used.
414
template <typename TLinkAddress> class ArgumentLinkDoesNotExistsException<TLinkAddress> : public std::invalid_argument
515
{
16+
/// @brief Constructs exception with link address and argument name.
17+
/// @param link The non-existent link address.
18+
/// @param argumentName The name of the argument that contained the invalid link.
619
public: ArgumentLinkDoesNotExistsException(TLinkAddress link, std::string argumentName) : std::invalid_argument(FormatMessage(link, argumentName), argumentName) { }
720

21+
/// @brief Constructs exception with link address only.
22+
/// @param link The non-existent link address.
823
public: ArgumentLinkDoesNotExistsException(TLinkAddress link) : std::invalid_argument(FormatMessage(link)) { }
924

25+
/// @brief Constructs exception with custom message and inner exception.
26+
/// @param message Custom error message.
27+
/// @param innerException The underlying exception that caused this error.
1028
public: ArgumentLinkDoesNotExistsException(std::string message, const std::exception& innerException) : std::invalid_argument(message, innerException) { }
1129

30+
/// @brief Constructs exception with custom message.
31+
/// @param message Custom error message.
1232
public: ArgumentLinkDoesNotExistsException(std::string message) : std::invalid_argument(message) { }
1333

34+
/// @brief Default constructor.
1435
public: ArgumentLinkDoesNotExistsException() { }
1536

37+
/// @brief Formats error message with link and argument name (in Russian).
38+
/// @param link The non-existent link address.
39+
/// @param argumentName The argument name.
40+
/// @return Formatted error message.
1641
private: static std::string FormatMessage(TLinkAddress link, std::string argumentName) { return std::string("Связь [").append(Platform::Converters::To<std::string>(link)).append("] переданная в аргумент [").append(argumentName).append("] не существует."); }
1742

43+
/// @brief Formats error message with link only (in Russian).
44+
/// @param link The non-existent link address.
45+
/// @return Formatted error message.
1846
private: static std::string FormatMessage(TLinkAddress link) { return std::string("Связь [").append(Platform::Converters::To<std::string>(link)).append("] переданная в качестве аргумента не существует."); }
1947
};
2048
}
Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,48 @@
1-
namespace Platform::Data::Exceptions
1+
/// @file ArgumentLinkHasDependenciesException.h
2+
/// @brief Exception for links that cannot be modified due to dependencies.
3+
4+
namespace Platform::Data::Exceptions
25
{
6+
/// @brief Generic template declaration for ArgumentLinkHasDependenciesException.
37
template <typename ...> class ArgumentLinkHasDependenciesException;
8+
9+
/// @brief Exception thrown when attempting to modify a link that has dependencies.
10+
/// @tparam TLinkAddress The type used for link addressing.
11+
///
12+
/// This exception indicates that a link cannot be modified or deleted because
13+
/// other links depend on it, which would break referential integrity.
414
template <typename TLinkAddress> class ArgumentLinkHasDependenciesException<TLinkAddress> : public std::invalid_argument
515
{
16+
/// @brief Constructs exception with link address and parameter name.
17+
/// @param link The link that has dependencies.
18+
/// @param paramName The parameter name that contained the link.
619
public: ArgumentLinkHasDependenciesException(TLinkAddress link, std::string paramName) : std::invalid_argument(FormatMessage(link, paramName), paramName) { }
720

21+
/// @brief Constructs exception with link address only.
22+
/// @param link The link that has dependencies.
823
public: ArgumentLinkHasDependenciesException(TLinkAddress link) : std::invalid_argument(FormatMessage(link)) { }
924

25+
/// @brief Constructs exception with custom message and inner exception.
26+
/// @param message Custom error message.
27+
/// @param innerException The underlying exception.
1028
public: ArgumentLinkHasDependenciesException(std::string message, const std::exception& innerException) : std::invalid_argument(message, innerException) { }
1129

30+
/// @brief Constructs exception with custom message.
31+
/// @param message Custom error message.
1232
public: ArgumentLinkHasDependenciesException(std::string message) : std::invalid_argument(message) { }
1333

34+
/// @brief Default constructor.
1435
public: ArgumentLinkHasDependenciesException() { }
1536

37+
/// @brief Formats error message with link and parameter name (in Russian).
38+
/// @param link The link that has dependencies.
39+
/// @param paramName The parameter name.
40+
/// @return Formatted error message.
1641
private: static std::string FormatMessage(TLinkAddress link, std::string paramName) { return std::string("У связи [").append(Platform::Converters::To<std::string>(link)).append("] переданной в аргумент [").append(paramName).append("] присутствуют зависимости, которые препятствуют изменению её внутренней структуры."); }
1742

43+
/// @brief Formats error message with link only (in Russian).
44+
/// @param link The link that has dependencies.
45+
/// @return Formatted error message.
1846
private: static std::string FormatMessage(TLinkAddress link) { return std::string("У связи [").append(Platform::Converters::To<std::string>(link)).append("] переданной в качестве аргумента присутствуют зависимости, которые препятствуют изменению её внутренней структуры."); }
1947
};
2048
}
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
namespace Platform::Data::Exceptions
1+
/// @file LinkWithSameValueAlreadyExistsException.h
2+
/// @brief Exception for duplicate link creation attempts.
3+
4+
namespace Platform::Data::Exceptions
25
{
6+
/// @brief Exception thrown when attempting to create a link that already exists.
7+
///
8+
/// This exception is raised when the system prevents creation of duplicate links
9+
/// with the same value, typically when uniqueness constraints are enforced.
310
class LinkWithSameValueAlreadyExistsException : public std::exception
411
{
12+
/// @brief Default error message in Russian.
513
public: inline static std::string DefaultMessage = "Связь с таким же значением уже существует.";
614

15+
/// @brief Constructs exception with custom message and inner exception.
16+
/// @param message Custom error message.
17+
/// @param innerException The underlying exception.
718
public: LinkWithSameValueAlreadyExistsException(std::string message, const std::exception& innerException) : base(message, innerException) { }
819

20+
/// @brief Constructs exception with custom message.
21+
/// @param message Custom error message.
922
public: LinkWithSameValueAlreadyExistsException(std::string message) : base(message) { }
1023

24+
/// @brief Default constructor using default message.
1125
public: LinkWithSameValueAlreadyExistsException() : base(DefaultMessage) { }
1226
};
1327
}
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1-
namespace Platform::Data::Exceptions
1+
/// @file LinksLimitReachedException.h
2+
/// @brief Typed exception for link storage limit violations.
3+
4+
namespace Platform::Data::Exceptions
25
{
6+
/// @brief Generic template declaration for LinksLimitReachedException.
37
template <typename ...> class LinksLimitReachedException;
8+
9+
/// @brief Typed exception thrown when link storage limits are reached.
10+
/// @tparam TLinkAddress The type used for link addressing.
411
template <typename TLinkAddress> class LinksLimitReachedException<TLinkAddress> : public LinksLimitReachedExceptionBase
512
{
13+
/// @brief Constructs exception with specific limit value.
14+
/// @param limit The limit value that was reached.
615
public: LinksLimitReachedException(TLinkAddress limit) : this(FormatMessage(limit)) { }
716

17+
/// @brief Constructs exception with custom message and inner exception.
18+
/// @param message Custom error message.
19+
/// @param innerException The underlying exception.
820
public: LinksLimitReachedException(std::string message, const std::exception& innerException) : LinksLimitReachedExceptionBase(message, innerException) { }
921

22+
/// @brief Constructs exception with custom message.
23+
/// @param message Custom error message.
1024
public: LinksLimitReachedException(std::string message) : LinksLimitReachedExceptionBase(message) { }
1125

26+
/// @brief Default constructor using base class default message.
1227
public: LinksLimitReachedException() : LinksLimitReachedExceptionBase(DefaultMessage) { }
1328

29+
/// @brief Formats error message with limit value (in Russian).
30+
/// @param limit The limit value that was reached.
31+
/// @return Formatted error message.
1432
private: static std::string FormatMessage(TLinkAddress limit) { return std::string("Достигнут лимит количества связей в хранилище (").append(Platform::Converters::To<std::string>(limit)).append(")."); }
1533
};
1634
}
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
namespace Platform::Data::Exceptions
1+
/// @file LinksLimitReachedExceptionBase.h
2+
/// @brief Base class for exceptions thrown when link storage limits are exceeded.
3+
4+
namespace Platform::Data::Exceptions
25
{
6+
/// @brief Base exception class for link storage limit violations.
7+
///
8+
/// This exception is thrown when operations would exceed the maximum
9+
/// number of links that can be stored in the system.
310
class LinksLimitReachedExceptionBase : public std::exception
411
{
12+
/// @brief Default error message in Russian.
513
public: inline static std::string DefaultMessage = "Достигнут лимит количества связей в хранилище.";
614

15+
/// @brief Protected constructor with custom message and inner exception.
16+
/// @param message Custom error message.
17+
/// @param innerException The underlying exception.
718
protected: LinksLimitReachedExceptionBase(std::string message, const std::exception& innerException) : base(message, innerException) { }
819

20+
/// @brief Protected constructor with custom message.
21+
/// @param message Custom error message.
922
protected: LinksLimitReachedExceptionBase(std::string message) : base(message) { }
1023
};
1124
}

cpp/Platform.Data/ILinks.h

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,63 @@
11
namespace Platform::Data
22
{
33
using namespace Platform::Interfaces;
4+
5+
/// @brief Core interface for managing links in a data structure.
6+
/// @tparam TLinksOptions Template parameter specifying the configuration options for links,
7+
/// including address type, link type, and handler types.
8+
///
9+
/// This interface defines the fundamental CRUD (Create, Read, Update, Delete) operations
10+
/// for working with links. A link represents a connection or relationship between data elements.
411
template<typename TLinksOptions>
512
struct ILinks
613
{
714
public:
8-
using LinksOptionsType = TLinksOptions;
9-
using LinkAddressType = typename LinksOptionsType::LinkAddressType;
10-
static constexpr LinksConstants<LinkAddressType> Constants = LinksOptionsType::Constants;
11-
using LinkType = typename LinksOptionsType::LinkType;
12-
using ReadHandlerType = typename LinksOptionsType::ReadHandlerType;
13-
using WriteHandlerType = typename LinksOptionsType::WriteHandlerType;
15+
/// @brief Type alias for the links options configuration.
16+
using LinksOptionsType = TLinksOptions;
17+
18+
/// @brief Type alias for link addresses used to identify links.
19+
using LinkAddressType = typename LinksOptionsType::LinkAddressType;
20+
21+
/// @brief Constants used throughout the links system.
22+
static constexpr LinksConstants<LinkAddressType> Constants = LinksOptionsType::Constants;
23+
24+
/// @brief Type alias for link data structures.
25+
using LinkType = typename LinksOptionsType::LinkType;
26+
27+
/// @brief Type alias for read operation handler functions.
28+
using ReadHandlerType = typename LinksOptionsType::ReadHandlerType;
29+
30+
/// @brief Type alias for write operation handler functions.
31+
using WriteHandlerType = typename LinksOptionsType::WriteHandlerType;
1432

33+
/// @brief Counts the number of links matching the specified restriction.
34+
/// @param restriction Vector of link addresses defining search criteria.
35+
/// @return Number of links matching the restriction.
1536
virtual LinkAddressType Count(const std::vector<LinkAddressType>& restriction) const = 0;
1637

38+
/// @brief Iterates through links matching the restriction and applies a handler to each.
39+
/// @param restriction Vector of link addresses defining search criteria.
40+
/// @param handler Function to be called for each matching link.
41+
/// @return Result code from the iteration operation.
1742
virtual LinkAddressType Each(const std::vector<LinkAddressType>& restriction, const ReadHandlerType& handler) const = 0;
1843

44+
/// @brief Creates a new link with the specified substitution values.
45+
/// @param substitution Vector of link addresses specifying the new link's properties.
46+
/// @param handler Function to handle the creation operation.
47+
/// @return Address of the created link or result code.
1948
virtual LinkAddressType Create(const std::vector<LinkAddressType>& substitution, const WriteHandlerType& handler) = 0;
2049

50+
/// @brief Updates existing links matching the restriction with new substitution values.
51+
/// @param restriction Vector of link addresses defining which links to update.
52+
/// @param substitution Vector of link addresses specifying the new values.
53+
/// @param handler Function to handle the update operation.
54+
/// @return Result code from the update operation.
2155
virtual LinkAddressType Update(const std::vector<LinkAddressType>& restriction, const std::vector<LinkAddressType>& substitution, const WriteHandlerType& handler) = 0;
2256

57+
/// @brief Deletes links matching the specified restriction.
58+
/// @param restriction Vector of link addresses defining which links to delete.
59+
/// @param handler Function to handle the deletion operation.
60+
/// @return Result code from the delete operation.
2361
virtual LinkAddressType Delete(const std::vector<LinkAddressType>& restriction, const WriteHandlerType& handler) = 0;
2462
};
2563
}
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
namespace Platform::Data
1+
/// @file ISynchronizedLinks.h
2+
/// @brief Thread-safe interface for link operations.
3+
4+
namespace Platform::Data
25
{
6+
/// @brief Generic template declaration for ISynchronizedLinks.
37
// TODO: rework Platform.Threading
48
template <typename ...> class ISynchronizedLinks;
9+
10+
/// @brief Interface combining thread synchronization with link operations.
11+
/// @tparam TLinkAddress The type used for link addressing.
12+
/// @tparam TLinks The underlying links implementation type.
13+
/// @tparam TConstants The constants type for link operations.
14+
///
15+
/// This interface provides thread-safe access to link operations by combining
16+
/// synchronization primitives with the core ILinks interface.
517
template <typename TLinkAddress, typename TLinks, typename TConstants> class ISynchronizedLinks<TLinkAddress, TLinks, TConstants> : public ISynchronized<TLinks>, ILinks<TLinkAddress, TConstants>
618
where TLinks : ILinks<TLinkAddress, TConstants>
719
where TConstants : LinksConstants<TLinkAddress>
820
{
921
public:
22+
/// @brief Empty interface body - functionality provided by base classes.
1023
}
1124
}

0 commit comments

Comments
 (0)