isapego commented on a change in pull request #9713: URL: https://github.com/apache/ignite/pull/9713#discussion_r781352973
########## File path: modules/platforms/cpp/network/include/ignite/network/data_buffer.h ########## @@ -0,0 +1,139 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _IGNITE_NETWORK_DATA_BUFFER +#define _IGNITE_NETWORK_DATA_BUFFER + +#include <ignite/impl/interop/interop_memory.h> +#include <ignite/impl/interop/interop_input_stream.h> + +namespace ignite +{ + namespace network + { + /** + * Data buffer. + */ + class IGNITE_IMPORT_EXPORT DataBuffer + { + public: + /** + * Default constructor. + */ + DataBuffer(); + + /** + * Constructor. + * + * @param data Data. + */ + explicit DataBuffer(const impl::interop::SP_ConstInteropMemory& data); + + /** + * Constructor. + * + * @param data Data. + * @param pos Start of data. + * @param len Length. + */ + DataBuffer(const impl::interop::SP_ConstInteropMemory& data, int32_t pos, int32_t len); + + /** + * Destructor. + */ + ~DataBuffer() + { + // No-op. + } + + /** + * Copy data from buffer to specified place in memory. + * + * @param dst Destination in memory. + * @param size Number of bytes to copy. + */ + void GetData(int8_t* dst, int32_t size); Review comment: Agree that naming is too general :). But I don't like `CopyTo` as well - to me anything with `Copy...` in it's name should be `const` and should not change internal state of the object. Maybe `Consume`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
