diff options
author | cobat <cobat@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
commit | 1d2e8a8e9976488ea69a7e4763aa749244f82612 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/memory/blob.h | |
parent | e486e109b08823b61996f2154f0bc6b7c27a4af4 (diff) | |
download | ydb-1d2e8a8e9976488ea69a7e4763aa749244f82612.tar.gz |
Restoring authorship annotation for <cobat@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/memory/blob.h')
-rw-r--r-- | util/memory/blob.h | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/util/memory/blob.h b/util/memory/blob.h index 4708ea6d1f..20c02a68df 100644 --- a/util/memory/blob.h +++ b/util/memory/blob.h @@ -61,7 +61,7 @@ public: using const_iterator = const_pointer; /** - * Constructs a null blob (data array points to nullptr). + * Constructs a null blob (data array points to nullptr). */ TBlob() noexcept : S_(nullptr, 0, nullptr) @@ -96,22 +96,22 @@ public: return *this; } - /// Swaps content of two data arrays. + /// Swaps content of two data arrays. inline void Swap(TBlob& r) noexcept { S_.Swap(r.S_); } - /// Returns a const reference to the data array. + /// Returns a const reference to the data array. inline const void* Data() const noexcept { return S_.Data; } - /// Returns the size of the data array in bytes. + /// Returns the size of the data array in bytes. inline size_t Length() const noexcept { return S_.Length; } - /// Checks if the object has an empty data array. + /// Checks if the object has an empty data array. Y_PURE_FUNCTION inline bool Empty() const noexcept { return !Length(); } @@ -121,17 +121,17 @@ public: return S_.Base != nullptr; } - /// Checks if the object has a data array. + /// Checks if the object has a data array. inline bool IsNull() const noexcept { return !Data(); } - /// Returns a const pointer of char type to the data array. + /// Returns a const pointer of char type to the data array. inline const char* AsCharPtr() const noexcept { return (const char*)Data(); } - /// Returns a const pointer of unsigned char type to the data array. + /// Returns a const pointer of unsigned char type to the data array. inline const unsigned char* AsUnsignedCharPtr() const noexcept { return (const unsigned char*)Data(); } @@ -140,13 +140,13 @@ public: return TStringBuf(AsCharPtr(), size()); } - /// Drops the data array. + /// Drops the data array. inline void Drop() noexcept { TBlob().Swap(*this); } /* - * Some stl-like methods + * Some stl-like methods */ /// Returns a const reference to the data array. @@ -157,7 +157,7 @@ public: return static_cast<const_pointer>(Data()); } - /// Returns the size of the data array in bytes. + /// Returns the size of the data array in bytes. inline size_t size() const noexcept { return Length(); } @@ -167,12 +167,12 @@ public: return Length(); } - /// Standard iterator. + /// Standard iterator. inline const_iterator Begin() const noexcept { return AsUnsignedCharPtr(); } - /// Standard iterator. + /// Standard iterator. inline const_iterator End() const noexcept { return Begin() + Size(); } @@ -181,26 +181,26 @@ public: return *(Begin() + n); } - /// Shortcut to SubBlob(0, len) + /// Shortcut to SubBlob(0, len) TBlob SubBlob(size_t len) const; - /// Creates a new object from the provided range [begin, end) of internal data. No memory allocation and no copy. - /// @details Increments the refcounter of the current object + /// Creates a new object from the provided range [begin, end) of internal data. No memory allocation and no copy. + /// @details Increments the refcounter of the current object TBlob SubBlob(size_t begin, size_t end) const; - /// Calls Copy() for the internal data. + /// Calls Copy() for the internal data. TBlob DeepCopy() const; - /// Creates a new blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies the data content. + /// Creates a new blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies the data content. static TBlob CopySingleThreaded(const void* data, size_t length); - /// Creates a new blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies the data content. + /// Creates a new blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies the data content. static TBlob Copy(const void* data, size_t length); - /// Creates a blob which doesn't own data. No refcounter, no memory allocation, no data copy. + /// Creates a blob which doesn't own data. No refcounter, no memory allocation, no data copy. static TBlob NoCopy(const void* data, size_t length); - /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. + /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. static TBlob FromFileSingleThreaded(const TString& path, EMappingMode); /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. @@ -215,27 +215,27 @@ public: /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. static TBlob FromFileSingleThreaded(const TString& path); - /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. + /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. static TBlob FromFile(const TString& path); - /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. + /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. static TBlob FromFileSingleThreaded(const TFile& file); - /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. + /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. static TBlob FromFile(const TFile& file); // TODO: drop Precharged* functions. - /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. + /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. static TBlob PrechargedFromFileSingleThreaded(const TString& path); - /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. + /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. static TBlob PrechargedFromFile(const TString& path); - /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file content as data. + /// Creates a precharged blob with a single-threaded (non atomic) refcounter. It maps the file content as data. static TBlob PrechargedFromFileSingleThreaded(const TFile& file); - /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file content as data. + /// Creates a precharged blob with a multi-threaded (atomic) refcounter. It maps the file content as data. static TBlob PrechargedFromFile(const TFile& file); /// Creates a locked blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. @@ -256,42 +256,42 @@ public: /// Creates a locked blob with a multi-threaded (atomic) refcounter from the mapped memory. static TBlob LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length); - /// Creates a blob with a single-threaded (non atomic) refcounter from the mapped memory. + /// Creates a blob with a single-threaded (non atomic) refcounter from the mapped memory. static TBlob FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length); - /// Creates a blob with a multi-threaded (atomic) refcounter from the mapped memory. + /// Creates a blob with a multi-threaded (atomic) refcounter from the mapped memory. static TBlob FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length); - /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread(). + /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread(). static TBlob FromFileContentSingleThreaded(const TString& path); - /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread(). + /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread(). static TBlob FromFileContent(const TString& path); - /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file using pread(). + /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file using pread(). static TBlob FromFileContentSingleThreaded(const TFile& file); - /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file using pread(). + /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file using pread(). static TBlob FromFileContent(const TFile& file); - /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread(). + /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread(). static TBlob FromFileContentSingleThreaded(const TFile& file, ui64 offset, size_t length); - /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread(). + /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the provided range of the file content using pread(). static TBlob FromFileContent(const TFile& file, ui64 offset, size_t length); - /// Creates a blob from the stream content with a single-threaded (non atomic) refcounter. + /// Creates a blob from the stream content with a single-threaded (non atomic) refcounter. static TBlob FromStreamSingleThreaded(IInputStream& in); - /// Creates a blob from the stream content with a multi-threaded (atomic) refcounter. + /// Creates a blob from the stream content with a multi-threaded (atomic) refcounter. static TBlob FromStream(IInputStream& in); - /// Creates a blob with a single-threaded (non atomic) refcounter. No memory allocation, no content copy. - /// @details The input object becomes empty. + /// Creates a blob with a single-threaded (non atomic) refcounter. No memory allocation, no content copy. + /// @details The input object becomes empty. static TBlob FromBufferSingleThreaded(TBuffer& in); - /// Creates a blob with a multi-threaded (atomic) refcounter. No memory allocation, no content copy. - /// @details The input object becomes empty. + /// Creates a blob with a multi-threaded (atomic) refcounter. No memory allocation, no content copy. + /// @details The input object becomes empty. static TBlob FromBuffer(TBuffer& in); /// Creates a blob from TString with a single-threaded (non atomic) refcounter. |