This file is indexed.

/usr/include/CLAM/OutPortPublisher.hxx is in libclam-dev 1.4.0-7.

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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
 * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
 *                         UNIVERSITAT POMPEU FABRA
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef __OutPortPublisher_hxx__
#define __OutPortPublisher_hxx__

#include "OutPort.hxx"

namespace CLAM
{

template< typename Token >
class OutPortPublisher : public OutPortBase
{
	typedef OutPort<Token> ProperOutPort;
public:
	OutPortPublisher( const std::string & name = "unnamed out port publisher", Processing * proc = 0 )
		: OutPortBase( name, proc ), mPublishedOutPort(0)
	{
		
	}

	virtual ~OutPortPublisher()
	{
		//disconnect published port
		if (mPublishedOutPort) 
		{
			mPublishedOutPort->UnsetPublisher();
			mPublishedOutPort->DisconnectFromAll();
			mPublishedOutPort = 0;
		}
		//disconnect visually connected inports
		for (InPortsList::iterator it = BeginVisuallyConnectedInPorts();
			it != EndVisuallyConnectedInPorts();
			it++ )
		(*it)->SetVisuallyConnectedOutPort(0);
		
	}

	void DisconnectFromAll()
	{
		CLAM_DEBUG_ASSERT( mPublishedOutPort != 0, "OutPortPublisher - no out port published" );
		mPublishedOutPort->DisconnectFromAll();
		mVisuallyConnectedPorts.clear();
	}
	void ConnectToIn( InPortBase& in)
	{
		CLAM_DEBUG_ASSERT( mPublishedOutPort != 0, "OutPortPublisher - no out port published" );
		mPublishedOutPort->ConnectToIn( in );
		in.SetVisuallyConnectedOutPort( this );
		mVisuallyConnectedPorts.push_back(&in);
	}
	
	void PublishOutPort( OutPortBase & out )
	{
		CLAM_ASSERT( SameType(GetTypeId(),out.GetTypeId()),
		"OutPortPublisher<Token>::PublishOutPort coudn't connect to outPort "
		"because was not templatized by the same Token type as OutPortPublisher" );

		CLAM_ASSERT( not out.IsPublisher(),
		"OutPortPublisher<Token>::PublishOutPort: can not publish a publisher (yet)");

		ConcretePublishOutPort( static_cast<ProperOutPort&>(out) );

	}
	void UnpublishOutPort()
	{
		mPublishedOutPort = 0;
	}
	bool IsPublisher() const
	{
		return true;

	}
	void ConcretePublishOutPort( ProperOutPort & out )
	{
		mPublishedOutPort = &out;
		out.SetPublisher( *this );
	}
	
	void DisconnectFromIn( InPortBase& in)
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::DisconnectFromIn() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		mPublishedOutPort->DisconnectFromIn( in );
		mVisuallyConnectedPorts.remove(&in);
	}
	
	bool IsConnectableTo(InPortBase & in)
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::IsConnectableTo() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		return mPublishedOutPort->IsConnectableTo( in );
	}
	
	bool IsVisuallyConnectedTo(InPortBase & in)
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher:IsVisuallyConnectedTo() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		return mPublishedOutPort->IsVisuallyConnectedTo( in );
	}
	
	Token & GetData(int offset=0)
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::GetData() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		return mPublishedOutPort->GetData( offset );
	}
	
	int GetSize()
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::GetSize() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		return mPublishedOutPort->GetSize();
	}
	
	void SetSize(int newSize)
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::SetSize() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		mPublishedOutPort->SetSize( newSize );
	}
	
	int GetHop()
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::GetHop() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		return mPublishedOutPort->GetHop();
	}
	
	void SetHop(int newHop)
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::SetHop() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		mPublishedOutPort->SetHop( newHop );
	}

	
	bool CanProduce()
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::CanProduce() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		return mPublishedOutPort->CanProduce();
	}	
	
	void CenterEvenRegions()
	{
		CLAM_ASSERT(mPublishedOutPort, "OutPortPublisher::CenterEvenRegions() A published port is missing. "
				"Consider using the method PublishOutPort( OutPortBase& out) ");
		mPublishedOutPort->CenterEvenRegions();
	}
	Token & GetLastWrittenData( int offset = 0 )
	{
		return mPublishedOutPort->GetLastWrittenData(offset);
	}

	virtual const std::type_info & GetTypeId() const 
	{
		return typeid(Token);
	};

	
protected:
	ProperOutPort * mPublishedOutPort;
};


} // namespace CLAM

#endif // __OutPortPublisher_hxx__