Path: blob/master/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp
41152 views
/*1* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_JFR_WRITERS_JFRPOSITION_INLINE_HPP25#define SHARE_JFR_WRITERS_JFRPOSITION_INLINE_HPP2627#include "jfr/writers/jfrPosition.hpp"2829template <typename AP>30inline const u1* Position<AP>::start_pos() const {31return _start_pos;32}3334template <typename AP>35inline void Position<AP>::set_start_pos(const u1* position) {36_start_pos = position;37}3839template <typename AP>40inline u1* Position<AP>::current_pos() {41return _current_pos;42}4344template <typename AP>45inline void Position<AP>::set_current_pos(const u1* new_position) {46_current_pos = const_cast<u1*>(new_position);47}4849template <typename AP>50inline void Position<AP>::set_current_pos(size_t size) {51_current_pos += size;52}5354template <typename AP>55inline const u1* Position<AP>::end_pos() const {56return _end_pos;57}5859template <typename AP>60inline void Position<AP>::set_end_pos(const u1* position) {61_end_pos = position;62}6364template <typename AP>65inline Position<AP>::Position(const u1* start_pos, size_t size) :66AP(),67_start_pos(start_pos),68_current_pos(const_cast<u1*>(start_pos)),69_end_pos(start_pos + size) {70}7172template <typename AP>73inline Position<AP>::Position() : _start_pos(NULL), _current_pos(NULL), _end_pos(NULL) {74}7576template <typename AP>77inline size_t Position<AP>::available_size() const {78return _end_pos - _current_pos;79}8081template <typename AP>82inline int64_t Position<AP>::used_offset() const {83return _current_pos - _start_pos;84}8586template <typename AP>87inline int64_t Position<AP>::current_offset() const {88return this->used_offset();89}9091template <typename AP>92inline size_t Position<AP>::used_size() const {93return (size_t)used_offset();94}9596template <typename AP>97inline void Position<AP>::reset() {98set_current_pos(_start_pos);99}100101#endif // SHARE_JFR_WRITERS_JFRPOSITION_INLINE_HPP102103104