1#ifndef ROSE_BinaryAnalysis_RelativeVirtualAddress_H
2#define ROSE_BinaryAnalysis_RelativeVirtualAddress_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/Address.h>
7#include <ROSE_DEPRECATED.h>
8#include <Cxx_GrammarDeclarations.h>
10#include <Sawyer/Optional.h>
13namespace BinaryAnalysis {
31#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
33 friend class boost::serialization::access;
36 void serialize(S &s,
const unsigned ) {
37 s & BOOST_SERIALIZATION_NVP(rva_);
38 s & BOOST_SERIALIZATION_NVP(section_);
71 rose_addr_t
rva()
const;
120 bool is_bound() const ROSE_DEPRECATED("use
isBound instead");
121 rose_addr_t get_rva() const ROSE_DEPRECATED("use
rva instead");
126 rose_addr_t get_va() const ROSE_DEPRECATED("use
va instead");
127 rose_addr_t get_rel() const ROSE_DEPRECATED("use
boundOffset instead");
129 std::
string to_string() const ROSE_DEPRECATED("use
toString instead");
Optionally bound relative virtual address.
RelativeVirtualAddress(const RelativeVirtualAddress &)
Copy constructor.
std::string toString() const
Convert to a string representation.
RelativeVirtualAddress & rva(rose_addr_t rva)
Assign a new RVA without adjusting the bound section.
RelativeVirtualAddress(const rose_addr_t rva, SgAsmGenericSection *=nullptr)
Conversion from numeric RVA.
Sawyer::Optional< rose_addr_t > boundOffset() const
Returns an offset from the currently bound section.
Sawyer::Optional< rose_addr_t > va() const
Return the absolute address if known.
RelativeVirtualAddress & bindBestSection(SgAsmGenericHeader *)
Binds this RVA to the best available section from the specified file header.
bool isBound() const
Determines whether this instance is associated with a file section.
RelativeVirtualAddress & bindSection(SgAsmGenericSection *)
Changes the section binding.
RelativeVirtualAddress()
Create a zero RVA not linked to any section.
rose_addr_t rva() const
Returns the offset.
static RelativeVirtualAddress sectionRelative(SgAsmGenericSection *, rose_addr_t sectionOffset)
Constructs a new instance from a section and offset.
rose_addr_t offsetFrom(SgAsmGenericSection *) const
Returns an offset relative to the specified section.
RelativeVirtualAddress operator=(const RelativeVirtualAddress &)
Assignment operator.
void increment(rose_addr_t amount)
Increment the address by the specified amount, keeping it attached to the same (if any) section.
SgAsmGenericSection * boundSection() const
Returns the section to which this RVA is bound.
Holds a value or nothing.
Contiguous region of a file.