This file is indexed.

/usr/include/odil/Writer.h is in libodil0-dev 0.4.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*************************************************************************
 * odil - Copyright (C) Universite de Strasbourg
 * Distributed under the terms of the CeCILL-B license, as published by
 * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 * for details.
 ************************************************************************/

#ifndef _ca5c06d2_04f9_4009_9e98_5607e1060379
#define _ca5c06d2_04f9_4009_9e98_5607e1060379

#include <ostream>
#include <string>

#include "odil/DataSet.h"
#include "odil/Element.h"
#include "odil/endian.h"
#include "odil/registry.h"
#include "odil/Tag.h"
#include "odil/Value.h"
#include "odil/VR.h"

namespace odil
{

/// @brief Write DICOM objects to a stream.
class Writer
{
public:
    /// @brief Encodings of sequence items.
    enum class ItemEncoding
    {
        ExplicitLength,
        UndefinedLength
    };

    /// @brief Output stream.
    std::ostream & stream;

    /// @brief Endianness.
    ByteOrdering byte_ordering;
    /// @brief Explicit-ness of the Value Representations.
    bool explicit_vr;
    /// @brief Encoding of sequence items.
    ItemEncoding item_encoding;
    /// @brief Presence of group length elements.
    bool use_group_length;

    /// @brief Build a writer.
    Writer(
        std::ostream & stream,
        ByteOrdering byte_ordering, bool explicit_vr,
        ItemEncoding item_encoding=ItemEncoding::ExplicitLength,
        bool use_group_length=false);

    /**
     * @brief Build a writer, derive byte ordering and explicit-ness of VR
     * from transfer syntax.
     */
    Writer(
        std::ostream & stream,
        std::string const & transfer_syntax,
        ItemEncoding item_encoding=ItemEncoding::ExplicitLength,
        bool use_group_length=false);

    /// @brief Write a data set.
    void write_data_set(DataSet const & data_set) const;

    /// @brief Write a tag.
    void write_tag(Tag const & tag) const;

    /// @brief Write an element (VR, VL and value).
    void write_element(Element const & element) const;

    /// @brief Write a file (meta-information and data set).
    static void write_file(
        DataSet const &data_set, std::ostream & stream,
        DataSet const & meta_information = DataSet(),
        std::string const & transfer_syntax = registry::ExplicitVRLittleEndian,
        ItemEncoding item_encoding=ItemEncoding::ExplicitLength,
        bool use_group_length=false);

private:

    struct Visitor
    {
        typedef void result_type;

        std::ostream & stream;
        VR vr;

        ByteOrdering byte_ordering;
        bool explicit_vr;
        ItemEncoding item_encoding;
        bool use_group_length;

        Visitor(
            std::ostream & stream, VR vr,
            ByteOrdering byte_ordering, bool explicit_vr, ItemEncoding item_encoding,
            bool use_group_length);

        result_type operator()(Value::Integers const & value) const;
        result_type operator()(Value::Reals const & value) const;
        result_type operator()(Value::Strings const & value) const;
        result_type operator()(Value::DataSets const & value) const;
        result_type operator()(Value::Binary const & value) const;

        template<typename T>
        void write_strings(T const & sequence, char padding) const;
    };
};

}

#endif // _ca5c06d2_04f9_4009_9e98_5607e1060379