From e1e6cbaeafc4905fb14946a12f0c9b8034c590b1 Mon Sep 17 00:00:00 2001 From: Charles Hastings Date: Fri, 15 Nov 2024 11:36:58 -0800 Subject: [PATCH] fix a few header and documentation errors --- cpp/include/cugraph/device_vector.hpp | 46 ++++++++++++++++++++++++- cpp/include/cugraph/edge_properties.hpp | 10 +++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/cpp/include/cugraph/device_vector.hpp b/cpp/include/cugraph/device_vector.hpp index 44fb61f451..dd5d1886c0 100644 --- a/cpp/include/cugraph/device_vector.hpp +++ b/cpp/include/cugraph/device_vector.hpp @@ -16,7 +16,7 @@ #pragma once -#include "cugraph_c/types.h" +#include #include #include @@ -71,33 +71,77 @@ class device_vector_t { data_ = vector.release(); } + /** + * Return a pointer of the specified type to the beginning of the vector + * + * @tparam T type for the array vector + * + * @return pointer to the beginning of the vector + */ template T* begin() { return reinterpret_cast(data_.data()); } + /** + * Return a const pointer of the specified type to the beginning of the vector + * + * @tparam T type for the array vector + * + * @return const pointer to the beginning of the vector + */ template T const* begin() const { return reinterpret_cast(data_.data()); } + /** + * Return a pointer of the specified type to the end of the vector + * + * @tparam T type for the array vector + * + * @return pointer to the end of the vector + */ template T* end() { return reinterpret_cast(data_.data()) + size_; } + /** + * Return a const pointer of the specified type to the end of the vector + * + * @tparam T type for the array vector + * + * @return const pointer to the end of the vector + */ template T const* end() const { return reinterpret_cast(data_.data()) + size_; } + /** + * Return the type of the vector + * + * @return type id of the type stored in the vector + */ cugraph_data_type_id_t type() const { return type_; } + + /** + * Return the number of elements in the vector + * + * @return number of elements in the vector + */ size_t size() const { return size_; } + /** + * Release the vector and shrink the memory used + * + * @param stream_view CUDA stream + */ void clear(rmm::cuda_stream_view stream_view) { data_.resize(0, stream_view); diff --git a/cpp/include/cugraph/edge_properties.hpp b/cpp/include/cugraph/edge_properties.hpp index f2b8a6997b..2b9272bb2e 100644 --- a/cpp/include/cugraph/edge_properties.hpp +++ b/cpp/include/cugraph/edge_properties.hpp @@ -16,9 +16,9 @@ #pragma once -#include "cugraph/device_vector.hpp" -#include "cugraph_c/types.h" +#include +#include #include #include #include @@ -139,7 +139,7 @@ class edge_properties_t { * @tparam value_t Typename for the property * @param idx Index of the property * - * @returns a read-only view for accessing the property + * @return a read-only view for accessing the property */ template edge_property_view_t view(size_t idx) const; @@ -154,13 +154,15 @@ class edge_properties_t { * @tparam value_t Typename for the property * @param idx Index of the property * - * @returns a read-write view for accessing the property + * @return a read-write view for accessing the property */ template edge_property_view_t mutable_view(size_t idx); /** * Return list of defined properties + * + * @return vector of defined property indexes */ std::vector defined() const;