本文整理汇总了C++中Port函数的典型用法代码示例。如果您正苦于以下问题:C++ Port函数的具体用法?C++ Port怎么用?C++ Port使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Port函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect_spatializer_radius_to
/** attempt to transform this controller into a spatialization
controller and connect to the given module's spatialization
control inputs. Returns true on success, false if given module
does not accept spatialization inputs. */
bool
Controller_Module::connect_spatializer_to ( Module *m )
{
connect_spatializer_radius_to( m );
/* these are for detecting related parameter groups which can be
better represented by a single control */
Port *azimuth_port = NULL;
float azimuth_value = 0.0f;
Port *elevation_port = NULL;
float elevation_value = 0.0f;
for ( unsigned int i = 0; i < m->control_input.size(); ++i )
{
Port *p = &m->control_input[i];
if ( !strcasecmp( "Azimuth", p->name() ) &&
180.0f == p->hints.maximum &&
-180.0f == p->hints.minimum )
{
azimuth_port = p;
azimuth_value = p->control_value();
continue;
}
else if ( !strcasecmp( "Elevation", p->name() ) &&
90.0f == p->hints.maximum &&
-90.0f == p->hints.minimum )
{
elevation_port = p;
elevation_value = p->control_value();
continue;
}
}
if ( ! ( azimuth_port && elevation_port ) )
return false;
if ( control_output.size() != 3 )
{
control_output.clear();
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
}
control_output[0].connect_to( azimuth_port );
control_output[1].connect_to( elevation_port );
maybe_create_panner();
Panner *o = (Panner*)control;
o->point( 0 )->azimuth( azimuth_value );
o->point( 0 )->elevation( elevation_value );
if ( Mixer::spatialization_console )
Mixer::spatialization_console->update();
return true;
}
示例2: switch
BString
BNetworkAddress::ToString(bool includePort) const
{
char buffer[512];
switch (fAddress.ss_family) {
case AF_INET:
inet_ntop(AF_INET, &((sockaddr_in&)fAddress).sin_addr, buffer,
sizeof(buffer));
break;
case AF_INET6:
inet_ntop(AF_INET6, &((sockaddr_in6&)fAddress).sin6_addr,
buffer, sizeof(buffer));
break;
case AF_LINK:
{
uint8 *byte = LinkLevelAddress();
char* target = buffer;
int bytesLeft = sizeof(buffer);
target[0] = '\0';
for (size_t i = 0; i < LinkLevelAddressLength(); i++) {
if (i != 0 && bytesLeft > 1) {
target[0] = ':';
target[1] = '\0';
target++;
bytesLeft--;
}
int bytesWritten = snprintf(target, bytesLeft, "%02x", byte[i]);
if (bytesWritten >= bytesLeft)
break;
target += bytesWritten;
bytesLeft -= bytesWritten;
}
break;
}
default:
return "";
}
BString address = buffer;
if (includePort && Port() != 0) {
if (fAddress.ss_family == AF_INET6) {
address = "[";
address += buffer;
address += "]";
}
snprintf(buffer, sizeof(buffer), ":%u", Port());
address += buffer;
}
return address;
}
示例3: Port
std::string IPv4EndPoint::ToString() const
{
auto field = (uint8_t*)_Addr.Field();
auto rv = std::to_string(field[4]) + '.' + std::to_string(field[5]) + '.' + std::to_string(field[6]) + '.' + std::to_string(field[7]);
if (Port() != 0)
rv += ':' + Port();
return rv;
}
示例4: TRasterFxPort
void TExternalProgramFx::addPort(std::string portName, std::string ext,
bool isInput) {
if (isInput) {
TRasterFxPort *port = new TRasterFxPort();
m_ports[portName] = Port(portName, ext, port);
addInputPort(portName, *port);
} else
m_ports[portName] = Port(portName, ext, 0);
}
示例5: skInfraredCOM
// -------------------------- Pixel --------------------------
Pixel::Pixel(uint8_t number_of_vertex) {
// プロトタイプ2号のピン配置
this->ports.push_back(Port(new skInfraredCOM(2, 11), 0));
this->ports.push_back(Port(new skInfraredCOM(3, 12), 0));
this->ports.push_back(Port(new skInfraredCOM(4, 13), 0));
this->configured = false;
this->device_id = 0;
this->number_of_vertex = number_of_vertex;
this->led = Adafruit_NeoPixel(1, 10, NEO_GRB + NEO_KHZ800);
this->led.begin();
}
示例6: SendEvents1
//_________________________________________________________
void SendEvents1 (short refNum)
{
SlotPtr slot = 0;
MidiEvPtr e;
while ((e = MidiGetEv (refNum))) {
if (!slot || (Slot(slot->refNum) != Port(e)))
slot = FindSlot(gOutSlots, Port(e));
if (slot) {
if (!MS2MM (refNum, slot, e)) return;
}else{
MidiFreeEv(e);
}
}
}
示例7: Module
Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
: Module ( is_default, 50, 100, name() )
{
box( FL_FLAT_BOX );
color( FL_BLACK );
_disable_context_menu = false;
_pad = true;
control_value = 0;
add_port( Port( this, Port::INPUT, Port::CONTROL ) );
control_input[0].hints.visible = false;
dpm_pack = new Fl_Scalepack( x(), y(), w(), h() );
dpm_pack->color( FL_BACKGROUND_COLOR );
dpm_pack->box( FL_FLAT_BOX );
dpm_pack->type( FL_HORIZONTAL );
end();
control_value = new float[1];
*control_value = -70.0f;
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );
clear_visible_focus();
}
示例8: rcvPort
//_____________________________________________________________________________
// port and channel parsing
//_____________________________________________________________________________
static MidiEvPtr rcvPort (UDPStreamPtr f, Byte c)
{
f->length--;
Port(f->ptrCur) = c;
f->parse = rcvChan;
return 0;
}
示例9: Port
DummyDevPackedVector4::DummyDevPackedVector4(const DeviceConfig & deviceConfig) {
this->deviceDescriptor.setEntityID(deviceConfig.getEntityID());
this->entityID = this->deviceDescriptor.getEntityID();
map<string, Port> portMap;
portMap["pv1"] = Port("pv1", "PackedVector4", Port::Source, "");
DeviceType deviceType;
deviceType.setPortMap(portMap);
deviceType.setDeviceTypeName("DummyDevPackedVector4");
deviceType.setDescription("");
this->deviceDescriptor.setDeviceType(deviceType);
std::map<std::string, int> nameChannelNrMap;
int nr = 1;
map<string, Port>::iterator i = portMap.begin();
map<string, Port>::iterator e = portMap.end();
while (i != e) {
nameChannelNrMap[(*i).second.getName()] = nr;
++nr;
++i;
}
this->deviceDescriptor.setNameChannelNrMap(nameChannelNrMap);
}
示例10: TestPort
/*____________________________________________________________________*/
static void TestPort( int i)
{
MidiEvPtr e;
int n, result= true;
for( n=0; n<LastPort; n++) {
e= MidiNewEv( typeKeyOn);
if( e) {
Port(e)= n;
MidiSendIm( refNum, e);
wait( 2);
e= GetReceived();
if( e) {
if( n== i) {
print ("\n error: port %d not filtered\n", n);
result= false;
}
MidiFreeEv( e);
}
else if( n!= i) {
print ("\n error: port %d filtered\n", n);
result= false;
}
}
else {
print ("\n cannot allocate a new event !\n");
break;
}
}
if( result) print ("ok\n");
}
示例11: memset
status_t
BNetworkAddress::ResolveForDestination(const BNetworkAddress& destination)
{
if (!IsWildcard())
return B_OK;
if (destination.fAddress.ss_family != fAddress.ss_family)
return B_BAD_VALUE;
char buffer[2048];
memset(buffer, 0, sizeof(buffer));
route_entry* route = (route_entry*)buffer;
route->destination = (sockaddr*)&destination.fAddress;
int socket = ::socket(fAddress.ss_family, SOCK_DGRAM, 0);
if (socket < 0)
return errno;
if (ioctl(socket, SIOCGETRT, route, sizeof(buffer)) != 0) {
close(socket);
return errno;
}
uint16 port = Port();
memcpy(&fAddress, route->source, sizeof(sockaddr_storage));
SetPort(port);
close(socket);
return B_OK;
}
示例12: Port
bool
BNetworkAddress::Equals(const BNetworkAddress& other, bool includePort) const
{
if (IsEmpty() && other.IsEmpty())
return true;
if (Family() != other.Family()
|| (includePort && Port() != other.Port())) {
return false;
}
switch (fAddress.ss_family) {
case AF_INET:
{
sockaddr_in& address = (sockaddr_in&)fAddress;
sockaddr_in& otherAddress = (sockaddr_in&)other.fAddress;
return memcmp(&address.sin_addr, &otherAddress.sin_addr,
sizeof(address.sin_addr)) == 0;
}
case AF_INET6:
{
sockaddr_in6& address = (sockaddr_in6&)fAddress;
sockaddr_in6& otherAddress = (sockaddr_in6&)other.fAddress;
return memcmp(&address.sin6_addr, &otherAddress.sin6_addr,
sizeof(address.sin6_addr)) == 0;
}
default:
if (fAddress.ss_len != other.fAddress.ss_len)
return false;
return memcmp(&fAddress, &other.fAddress, fAddress.ss_len);
}
}
示例13: Port
void PortList::addNewPort(bt::Uint16 number,Protocol proto,bool forward)
{
Port p = Port(number,proto,forward);
append(p);
if (lst)
lst->portAdded(p);
}
示例14: malloc
PortSet PortsManager::GetNowPorts()
{
PortSet newPorts;
PMIB_TCPTABLE pTcpTable;
DWORD dwSize = 0;
DWORD dwRetVal = 0;
unsigned short *port_ptr;
DWORD i;
/* Get size required by GetTcpTable() */
if (GetTcpTable(NULL, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) {
pTcpTable = (MIB_TCPTABLE *) malloc (dwSize);
}
/* Get actual data using GetTcpTable() */
if ((dwRetVal = GetTcpTable(pTcpTable, &dwSize, 0)) == NO_ERROR) {
if (pTcpTable->dwNumEntries > 0) {
for (i=0; i<pTcpTable->dwNumEntries; i++) {
//addr_ptr = (char *)&pTcpTable->table[i].dwLocalAddr;
//port_ptr = (unsigned short *)&pTcpTable->table[i].dwLocalPort;
//addr_ptr = (char *)&pTcpTable->table[i].dwRemoteAddr;
port_ptr = (unsigned short *)&pTcpTable->table[i].dwRemotePort;
DWORD state = pTcpTable->table[i].dwState;
newPorts.insert(Port(*port_ptr, state));
}
}
}
free(pTcpTable);
return newPorts;
}
示例15: DefaultPort
void
nsHttpConnectionInfo::SetOriginServer(const nsACString &host, int32_t port)
{
mHost = host;
mPort = port == -1 ? DefaultPort() : port;
//
// build hash key:
//
// the hash key uniquely identifies the connection type. two connections
// are "equal" if they end up talking the same protocol to the same server
// and are both used for anonymous or non-anonymous connection only;
// anonymity of the connection is setup later from nsHttpChannel::AsyncOpen
// where we know we use anonymous connection (LOAD_ANONYMOUS load flag)
//
const char *keyHost;
int32_t keyPort;
if (mUsingHttpProxy && !mUsingConnect) {
keyHost = ProxyHost();
keyPort = ProxyPort();
}
else {
keyHost = Host();
keyPort = Port();
}
mHashKey.AssignLiteral("....");
mHashKey.Append(keyHost);
mHashKey.Append(':');
mHashKey.AppendInt(keyPort);
if (mUsingHttpProxy)
mHashKey.SetCharAt('P', 0);
if (mUsingSSL)
mHashKey.SetCharAt('S', 1);
// NOTE: for transparent proxies (e.g., SOCKS) we need to encode the proxy
// info in the hash key (this ensures that we will continue to speak the
// right protocol even if our proxy preferences change).
//
// NOTE: for SSL tunnels add the proxy information to the cache key.
// We cannot use the proxy as the host parameter (as we do for non SSL)
// because this is a single host tunnel, but we need to include the proxy
// information so that a change in proxy config will mean this connection
// is not reused
if ((!mUsingHttpProxy && ProxyHost()) ||
(mUsingHttpProxy && mUsingConnect)) {
mHashKey.AppendLiteral(" (");
mHashKey.Append(ProxyType());
mHashKey.Append(':');
mHashKey.Append(ProxyHost());
mHashKey.Append(':');
mHashKey.AppendInt(ProxyPort());
mHashKey.Append(')');
}
}