text stringlengths 4 6.14k |
|---|
// DEPRECATED: Use GraphDefBuilder instead.
#ifndef TENSORFLOW_GRAPH_TESTLIB_H_
#define TENSORFLOW_GRAPH_TESTLIB_H_
#include <string>
#include <vector>
#include "tensorflow/core/graph/graph.h"
#include "tensorflow/core/graph/types.h"
#include "tensorflow/core/platform/port.h"
#include "tensorflow/core/public/tensor.h"
#include "tensorflow/core/public/tensor_shape.h"
namespace tensorflow {
namespace test {
namespace graph {
// Converts "g" into its corresponding GraphDef "def".
// DEPRECATED: call g->ToGraphDef(def) instead.
void ToGraphDef(Graph* g, GraphDef* def);
// A few helpers to construct a graph.
// Adds a node in "g" producing a constant "tensor".
Node* Constant(Graph* g, const Tensor& tensor);
Node* Constant(Graph* g, const Tensor& tensor, const string& name);
// Adds a variable in "g" of the given "shape" and "dtype".
Node* Var(Graph* g, const DataType dtype, const TensorShape& shape);
// Adds an assign node in "g" which assigns "val" into "var".
Node* Assign(Graph* g, Node* var, Node* val);
// Adds a send node "g" sending "input" as a named "tensor" from
// "sender" to "receiver".
Node* Send(Graph* g, Node* input, const string& tensor, const string& sender,
const uint64 sender_incarnation, const string& receiver);
// Adds a recv node in "g" receiving a named "tensor" from "sender"
// to "receiver".
Node* Recv(Graph* g, const string& tensor, const string& type,
const string& sender, const uint64 sender_incarnation,
const string& receiver);
// Adds a reduction "node" in "g" doing sum(data, axes). "reduce" is
// a reduction, e.g., Sum, Max, Min, Mean, etc.
Node* Reduce(Graph* g, const string& reduce, Node* data, Node* axes,
bool keep_dims = false);
// Adds a Matmul node in g doing in0.contract(in1).
Node* Matmul(Graph* g, Node* in0, Node* in1, bool transpose_a,
bool transpose_b);
// Adds a Quantize node into g that quantize floats into QUINT8. The range of
// the input float tensor is assumed to be [-1, 1].
Node* QuantizeToUINT8(Graph* g, Node* data);
// Adds a unary function "func" "node" in "g" taking "input".
Node* Unary(Graph* g, const string& func, Node* input, int index = 0);
// Adds an identity node in "g" taking "input" and producing an
// identity copy.
Node* Identity(Graph* g, Node* input, int index = 0);
// Adds a binary function "func" node in "g" taking "in0" and "in1".
Node* Binary(Graph* g, const string& func, Node* in0, Node* in1);
// Adds a function "func" node in "g" taking inputs "ins".
Node* Multi(Graph* g, const string& func, gtl::ArraySlice<Node*> ins);
// Adds a binary add node in "g" doing in0 + in1.
Node* Add(Graph* g, Node* in0, Node* in1);
// Generates random unit uniform distribution of the input shape.
Node* RandomUniform(Graph* g, Node* input, DataType dtype);
// Generates random unit normal distribution of the input shape.
Node* RandomGaussian(Graph* g, Node* input, DataType dtype);
// Generates random parameters from the truncated standard normal distribution
// of the nput shape
Node* RandomParameters(Graph* g, Node* input, DataType dtype);
// Adds an error node in "g". The node's computation always
// generates an error with the given error message "errmsg".
Node* Error(Graph* g, Node* input, const string& errmsg);
// Adds a node that generates a invalid ref output.
Node* InvalidRefType(Graph* g, DataType out_type, DataType invalid_type);
// Adds a node in "g". Its Compute() sleeps a while and outputs the
// input (i.e., same as identity).
Node* Delay(Graph* g, Node* input, Microseconds delay_micros);
// Adds a no-op "node" in "g", with control inputs from all nodes in
// control_inputs vector.
Node* NoOp(Graph* g, const std::vector<Node*>& control_inputs);
// Adds a Switch node in "g". If "in1" is true, it forwards "in0" to
// output 1. Otherwise, it forwards "in0" to output 0.
Node* Switch(Graph* g, Node* in0, Node* in1);
// Adds an Enter node in "g", which enters a new frame.
Node* Enter(Graph* g, Node* input, const string& frame_name);
// Adds an Exit node in "g", which exits a frame.
Node* Exit(Graph* g, Node* input);
// Adds a Merge node in "g" with two inputs "in0" and "in1".
Node* Merge(Graph* g, Node* in0, Node* in1);
// Adds a Merge node in "g". The first input is "in0", the remaining
// inputs are only given by their names in remaining_in.
Node* Merge(Graph* g, Node* in0, gtl::ArraySlice<string> remaining_in);
// Adds a NextIteration node in "g", which makes its input available
// to the next iteration.
Node* Next(Graph* g, const string& name, Node* input);
// Adds a LoopCond node in "g", representing the "pivot" termination
// condition of a loop.
Node* LoopCond(Graph* g, Node* input);
// Adds a less node in "g", which returns true iff "in0" < "in1".
Node* Less(Graph* g, Node* in0, Node* in1);
// Adds a select node in "g", which outputs either "inx" or "iny"
// depending on the boolean value of "c".
Node* Select(Graph* g, Node* c, Node* inx, Node* iny);
// Casts "in" into data type "dst".
Node* Cast(Graph* g, Node* in, DataType dst);
} // end namespace graph
} // end namespace test
} // end namespace tensorflow
#endif // TENSORFLOW_GRAPH_TESTLIB_H_
|
/*
*
* Copyright (c) 2021 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <app/OperationalDeviceProxy.h>
#include <lib/support/Pool.h>
#include <transport/SessionHandle.h>
namespace chip {
class OperationalDeviceProxyPoolDelegate
{
public:
virtual OperationalDeviceProxy * Allocate(DeviceProxyInitParams & params, PeerId peerId) = 0;
virtual OperationalDeviceProxy * Allocate(DeviceProxyInitParams & params, PeerId peerId,
const Dnssd::ResolvedNodeData & nodeResolutionData) = 0;
virtual void Release(OperationalDeviceProxy * device) = 0;
virtual OperationalDeviceProxy * FindDevice(const SessionHandle & session) = 0;
virtual OperationalDeviceProxy * FindDevice(PeerId peerId) = 0;
virtual void ReleaseDevicesForFabric(CompressedFabricId compressedFabricId) = 0;
virtual void ReleaseAllDevices() = 0;
virtual ~OperationalDeviceProxyPoolDelegate() {}
};
template <size_t N>
class OperationalDeviceProxyPool : public OperationalDeviceProxyPoolDelegate
{
public:
~OperationalDeviceProxyPool() { mDevicePool.ReleaseAll(); }
OperationalDeviceProxy * Allocate(DeviceProxyInitParams & params, PeerId peerId) override
{
return mDevicePool.CreateObject(params, peerId);
}
OperationalDeviceProxy * Allocate(DeviceProxyInitParams & params, PeerId peerId,
const Dnssd::ResolvedNodeData & nodeResolutionData) override
{
return mDevicePool.CreateObject(params, peerId, nodeResolutionData);
}
void Release(OperationalDeviceProxy * device) override { mDevicePool.ReleaseObject(device); }
OperationalDeviceProxy * FindDevice(const SessionHandle & session) override
{
OperationalDeviceProxy * foundDevice = nullptr;
mDevicePool.ForEachActiveObject([&](auto * activeDevice) {
if (activeDevice->MatchesSession(session))
{
foundDevice = activeDevice;
return Loop::Break;
}
return Loop::Continue;
});
return foundDevice;
}
OperationalDeviceProxy * FindDevice(PeerId peerId) override
{
OperationalDeviceProxy * foundDevice = nullptr;
mDevicePool.ForEachActiveObject([&](auto * activeDevice) {
if (activeDevice->GetPeerId() == peerId)
{
foundDevice = activeDevice;
return Loop::Break;
}
return Loop::Continue;
});
return foundDevice;
}
void ReleaseDevicesForFabric(CompressedFabricId compressedFabricId) override
{
mDevicePool.ForEachActiveObject([&](auto * activeDevice) {
if (activeDevice->GetPeerId().GetCompressedFabricId() == compressedFabricId)
{
Release(activeDevice);
}
return Loop::Continue;
});
}
void ReleaseAllDevices() override
{
mDevicePool.ForEachActiveObject([&](auto * activeDevice) {
Release(activeDevice);
return Loop::Continue;
});
}
private:
ObjectPool<OperationalDeviceProxy, N> mDevicePool;
};
}; // namespace chip
|
/*
* Phoenix is released under the MIT License. Refer to https://github.com/kasper/phoenix/blob/master/LICENSE.md
*/
@import Foundation;
@protocol PHPreprocessor <NSObject>
#pragma mark - Preprocessing
+ (NSString *) process:(NSString *)script atPath:(NSString *)path error:(NSError **)error;
@end
|
//
// Copyright (c) 2014 Limit Point Systems, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Declaration of pod_types facet of namespace sheaf..
#ifndef POD_TYPES_H
#define POD_TYPES_H
#ifndef SHEAF_DLL_SPEC_H
#include "SheafSystem/sheaf_dll_spec.h"
#endif
#ifndef SHEAF_H
#include "SheafSystem/sheaf.h"
#endif
#ifndef STD_IOSTREAM_H
#include "SheafSystem/std_iostream.h"
#endif
namespace sheaf
{
// =============================================================================
// POD TYPES FACET
// =============================================================================
// POD (Plain Old Data) types associated with sheaf primitives of class type.
// If you change pod_index_type, review primitive_type::not_a_primitive_type
///
/// The plain old data index type.
///
typedef int_type pod_index_type;
///
/// The invalid pod index value.
///
SHEAF_DLL_SPEC pod_index_type invalid_pod_index();
///
/// True if an only if xpod_index is valid.
///
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index);
///
/// The maximum pod index value.
///
SHEAF_DLL_SPEC pod_index_type max_pod_index();
///
/// The minimum pod index value.
///
SHEAF_DLL_SPEC pod_index_type min_pod_index();
///
/// POD type for scoped_index
///
typedef pod_index_type scoped_index_pod_type;
///
/// POD type for namespace_relative_member_index.
///
struct SHEAF_DLL_SPEC namespace_relative_member_index_pod_type
{
pod_index_type poset_id;
pod_index_type member_id;
bool operator==(const namespace_relative_member_index_pod_type& xother) const;
bool is_valid();
};
///
/// The invalid namespace_relative_member_index_pod_type value.
///
SHEAF_DLL_SPEC namespace_relative_member_index_pod_type invalid_namespace_relative_member_index_pod();
///
/// Inserts namespace_relative_member_index_pod_type xpod into ostream xos
///
SHEAF_DLL_SPEC
std::ostream&
operator<<(std::ostream& xos, const namespace_relative_member_index_pod_type& xpod);
///
/// Extracts namespace_relative_member_index_pod_type xpod from istream xis
///
SHEAF_DLL_SPEC
std::istream&
operator>>(std::istream& xis, namespace_relative_member_index_pod_type& xindex);
///
/// POD type associated with namespace_relative_subposet_index.
///
struct SHEAF_DLL_SPEC namespace_relative_subposet_index_pod_type
{
pod_index_type poset_id;
pod_index_type subposet_id;
bool operator==(const namespace_relative_subposet_index_pod_type& xother) const;
bool is_valid();
};
///
/// The invalid namespace_relative_subposet_index_pod_type value.
///
SHEAF_DLL_SPEC namespace_relative_subposet_index_pod_type invalid_namespace_relative_subposet_index_pod();
///
/// Inserts namespace_relative_subposet_index_pod_type xpod into ostream xos
///
SHEAF_DLL_SPEC
std::ostream&
operator<<(std::ostream& xos, const namespace_relative_subposet_index_pod_type& xpod);
///
/// Extracts namespace_relative_subposet_index_pod_type xpod from istream xis
///
SHEAF_DLL_SPEC
std::istream&
operator>>(std::istream& xis, namespace_relative_subposet_index_pod_type& xindex);
} // namespace sheaf
#endif // ifndef POD_TYPES_H
|
/*
* Test FreeRTOS trace facility functions. These following functions are enabled
* when configUSE_TRACE_FACILITY is defined 1 in FreeRTOS.
* Tasks: uxTaskGetTaskNumber(), uxTaskSetTaskNumber()
* Queues: ucQueueGetQueueType(), vQueueSetQueueNumber(), uxQueueGetQueueNumber()
* Event Groups: xEventGroupSetBitsFromISR(), xEventGroupClearBitsFromISR(), uxEventGroupGetNumber()
*
* Note: uxTaskGetSystemState() is tested in a separate unit test
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/event_groups.h"
#include "unity.h"
#include "test_utils.h"
#ifdef CONFIG_FREERTOS_USE_TRACE_FACILITY
#define TSK_PRIORITY (UNITY_FREERTOS_PRIORITY + 1)
#define NO_OF_CORES portNUM_PROCESSORS
#define BIN_SEM_QUEUE_TYPE queueQUEUE_TYPE_BINARY_SEMAPHORE //Expected Queue Type
static QueueHandle_t test_queues[NO_OF_CORES];
static TaskHandle_t task_handles[NO_OF_CORES];
void task_test_trace_utilities(void *arg)
{
int core = xPortGetCoreID();
TaskHandle_t handle = xTaskGetCurrentTaskHandle();
uint32_t id = (uint32_t)arg;
vTaskSetTaskNumber(handle, (UBaseType_t)id); //cast and store id as task number
vQueueSetQueueNumber(test_queues[core], id); //store id as queue number
//Wait to start
xSemaphoreTake(test_queues[core], portMAX_DELAY);
//Tests on this core
TEST_ASSERT(uxTaskGetTaskNumber(task_handles[core]) == (0x0F << (core)));
TEST_ASSERT(uxQueueGetQueueNumber(test_queues[core]) == (0x0F << (core)));
TEST_ASSERT(ucQueueGetQueueType(test_queues[core]) == BIN_SEM_QUEUE_TYPE)
//Test on other core
#ifndef CONFIG_FREERTOS_UNICORE
TEST_ASSERT(uxTaskGetTaskNumber(task_handles[!core]) == (0x0F << (!core)));
TEST_ASSERT(uxQueueGetQueueNumber(test_queues[!core]) == (0x0F << (!core)));
TEST_ASSERT(ucQueueGetQueueType(test_queues[!core]) == BIN_SEM_QUEUE_TYPE)
#endif
xSemaphoreGive(test_queues[core]); //Signal done
vTaskDelete(NULL);
}
TEST_CASE("Test freertos trace facility functions", "[freertos]")
{
for(int i = 0; i < NO_OF_CORES; i++){
test_queues[i] = xSemaphoreCreateBinary(); //Create a queue as binary semaphore for each core
xTaskCreatePinnedToCore(task_test_trace_utilities, "Test Task", 4096, (void *)(0x0F << i), TSK_PRIORITY, &task_handles[i], i);
}
vTaskDelay(10);
//Start the tasks
for(int i = NO_OF_CORES - 1; i >= 0; i--){
xSemaphoreGive(test_queues[i]);
}
vTaskDelay(10); //Small delay to ensure semaphores are taken
//Wait for done
for(int i = 0; i < NO_OF_CORES; i++){
xSemaphoreTake(test_queues[i], portMAX_DELAY);
vSemaphoreDelete(test_queues[i]);
}
vTaskDelay(10); //Give time for idle task to clean up
}
#define MAX_TASKS 15
#define TASKS_TO_CREATE 5
static TaskHandle_t created_handles[TASKS_TO_CREATE];
static TaskStatus_t *tsk_status_array;
void created_task(void* arg)
{
while(1){
vTaskDelay(100);
}
}
TEST_CASE("Test freertos uxTaskGetSystemState", "[freertos]")
{
tsk_status_array = calloc(MAX_TASKS, sizeof(TaskStatus_t));
for(int i = 0; i < TASKS_TO_CREATE; i++){
xTaskCreatePinnedToCore(created_task, "Created Task", 1024, NULL, TSK_PRIORITY, &created_handles[i], 0);
}
//Get System states
int no_of_tasks = uxTaskGetSystemState(tsk_status_array, MAX_TASKS, NULL);
TEST_ASSERT((no_of_tasks > 0) && (no_of_tasks <= MAX_TASKS));
//Check if get system state has got all created tasks
bool not_found = false;
for(int i = 0; i < TASKS_TO_CREATE; i++){
bool found = false;
for(int j = 0; j < MAX_TASKS; j++){
if(tsk_status_array[j].xHandle == created_handles[i]){
found = true;
break;
}
}
if(!found){
not_found = true;
break;
}
}
TEST_ASSERT(not_found == false);
//Cleanup
for(int i = 0; i < TASKS_TO_CREATE; i++){
vTaskDelete(created_handles[i]);
}
free(tsk_status_array);
vTaskDelay(10);
}
#endif //CONFIG_FREERTOS_USE_TRACE_FACILITY
|
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <strings.h>
#include "esp_flash_encrypt.h"
#include "esp_secure_boot.h"
#include "esp_efuse.h"
#include "esp_efuse_table.h"
#include "esp_log.h"
#include "sdkconfig.h"
static __attribute__((unused)) const char *TAG = "flash_encrypt";
esp_err_t esp_flash_encryption_enable_secure_features(void)
{
/* CRYPT_CONFIG determines which bits of the AES block key are XORed
with bits from the flash address, to provide the key tweak.
CRYPT_CONFIG == 0 is effectively AES ECB mode (NOT SUPPORTED)
For now this is hardcoded to XOR all 256 bits of the key.
If you need to override it, you can pre-burn this efuse to the
desired value and then write-protect it, in which case this
operation does nothing. Please note this is not recommended!
*/
ESP_LOGI(TAG, "Setting CRYPT_CONFIG efuse to 0xF");
uint32_t crypt_config = 0;
esp_efuse_read_field_blob(ESP_EFUSE_ENCRYPT_CONFIG, &crypt_config, 4);
if (crypt_config == 0) {
crypt_config = EFUSE_FLASH_CRYPT_CONFIG;
esp_efuse_write_field_blob(ESP_EFUSE_ENCRYPT_CONFIG, &crypt_config, 4);
} else if (crypt_config != EFUSE_FLASH_CRYPT_CONFIG) {
ESP_LOGE(TAG, "EFUSE_ENCRYPT_CONFIG should be set 0xF but it is 0x%x", crypt_config);
}
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
ESP_LOGI(TAG, "Disable UART bootloader encryption...");
esp_efuse_write_field_bit(ESP_EFUSE_DISABLE_DL_ENCRYPT);
#else
ESP_LOGW(TAG, "Not disabling UART bootloader encryption");
#endif
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC
ESP_LOGI(TAG, "Disable UART bootloader decryption...");
esp_efuse_write_field_bit(ESP_EFUSE_DISABLE_DL_DECRYPT);
#else
ESP_LOGW(TAG, "Not disabling UART bootloader decryption - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE
ESP_LOGI(TAG, "Disable UART bootloader MMU cache...");
esp_efuse_write_field_bit(ESP_EFUSE_DISABLE_DL_CACHE);
#else
ESP_LOGW(TAG, "Not disabling UART bootloader MMU cache - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
ESP_LOGI(TAG, "Disable JTAG...");
esp_efuse_write_field_bit(ESP_EFUSE_DISABLE_JTAG);
#else
ESP_LOGW(TAG, "Not disabling JTAG - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC
ESP_LOGI(TAG, "Disable ROM BASIC interpreter fallback...");
esp_efuse_write_field_bit(ESP_EFUSE_CONSOLE_DEBUG_DISABLE);
#else
ESP_LOGW(TAG, "Not disabling ROM BASIC fallback - SECURITY COMPROMISED");
#endif
#if defined(CONFIG_SECURE_BOOT_V2_ENABLED) && !defined(CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS)
// This bit is set when enabling Secure Boot V2, but we can't enable it until this later point in the first boot
// otherwise the Flash Encryption key cannot be read protected
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_EFUSE_RD_DISABLE);
#endif
return ESP_OK;
}
|
#ifndef _CORE_SET_H_
#define _CORE_SET_H_
#define G_SET_USER_UNORDER
#ifdef G_SET_USER_UNORDER
#include "gunorderset.h"
namespace gsystem { // gsystem
template < typename KeyT,
typename HashT = GHashF<KeyT>,
typename CompareT = GEqualToF<KeyT>>
class GSet final
: public GUnorderSet<KeyT, HashT, CompareT> {};
} // namespace gsystem
#else // !G_SET_USER_UNORDER
#include "gorderset.h"
namespace gsystem { // gsystem
template < typename KeyT,
typename CompareT = GCompareToF < KeyT >>
class GSet final
: public GOrderSet<KeyT, CompareT> {};
} // namespace gsystem
#endif // G_SET_USER_UNORDER
#endif // _CORE_SET_H_ |
//
// DNThemeManager.h
// DoubleNode.com
//
// Derived from work originally created by Darren Ehlers
// Portions Copyright (c) 2012 DoubleNode.com and Darren Ehlers.
// All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DNUtilities.h"
#import "ADVTheme.h"
@class DNTextView, DNTextField, DNLabel, DNSegmentedControl;
@protocol DNThemeProtocol <ADVTheme, NSObject>
- (UIColor*)primaryColor;
- (UIColor*)secondaryColor;
- (void)resetCache;
- (SEL)functionNameForAttribute:(NSString*)attribute
withType:(NSString*)type
andGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item
andControlState:(NSString*)controlStateString;
@end
@interface DNThemeManager : ADVThemeManager
+ (NSString*)themeName;
+ (id <DNThemeProtocol>)sharedTheme;
+ (UIColor*)primaryColor;
+ (UIColor*)secondaryColor;
+ (void)resetCache;
+ (NSString*)customizeNibNameWithClass:(NSString*)className
withGroup:(NSString*)group
andScreen:(NSString*)screen;
+ (void)customizeView:(UIView*)view
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeView:(UIView*)view
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeLabel:(UILabel*)lblView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeLabel:(UILabel*)lblView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeImage:(UIImageView*)imgView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeImage:(UIImageView*)imgView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeButton:(UIButton*)btnView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeButton:(UIButton*)btnView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeTextField:(UITextField*)txtfldView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeTextField:(UITextField*)txtfldView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeTextView:(UITextView*)txtView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeTextView:(UITextView*)txtView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeSegmentedControl:(UISegmentedControl*)segmentedControl
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeSegmentedControl:(UISegmentedControl*)segmentedControl
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeBarButtonItem:(UIBarButtonItem*)barButtonItem
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeBarButtonItem:(UIBarButtonItem*)barButtonItem
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
+ (void)customizeSwitch:(UISwitch*)switchView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andItem:(NSString*)item;
+ (void)customizeSwitch:(UISwitch*)switchView
withGroup:(NSString*)group
andScreen:(NSString*)screen
andViewState:(NSString*)viewState
andItem:(NSString*)item;
@end
|
#ifndef _LM_FF_H_
#define _LM_FF_H_
#include <vector>
#include <string>
#include "hg.h"
#include "ff.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
// everything in this file is deprecated and may be broken.
// Chris Dyer, Mar 2011
class LanguageModelInterface {
public:
double floor_;
LanguageModelInterface() : floor_(-100) { }
virtual ~LanguageModelInterface() { }
// not clamped to floor. log10prob
virtual double WordProb(WordID word, WordID const* context) = 0;
inline double WordProbFloored(WordID word, WordID const* context) {
return clamp(WordProb(word,context));
}
// may be shorter than actual null-terminated length. context must be null terminated. len is just to save effort for subclasses that don't support contextID
virtual int ContextSize(WordID const* context,int len) = 0;
// use this as additional logprob when shortening the context as above
virtual double ContextBOW(WordID const* context,int shortened_len) = 0; // unlikely that you'll ever need to floor a backoff cost. i'd say impossible.
inline double ShortenContext(WordID * context,int len) {
int slen=ContextSize(context,len);
double p=ContextBOW(context,slen);
while (len>slen) {
--len;
context[len]=0;
}
return p;
}
/// should be worse prob = more negative. that's what SRI wordProb returns: log10(prob)
inline double clamp(double logp) const {
return logp < floor_ ? floor_ : logp;
}
};
struct LanguageModelImpl;
class LanguageModel : public FeatureFunction {
public:
// param = "filename.lm [-o n]"
LanguageModel(const std::string& param);
~LanguageModel();
virtual void FinalTraversalFeatures(const void* context,
SparseVector<double>* features) const;
std::string DebugStateToString(const void* state) const;
static std::string usage(bool param,bool verbose);
protected:
virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
const HG::Edge& edge,
const std::vector<const void*>& ant_contexts,
SparseVector<double>* features,
SparseVector<double>* estimated_features,
void* out_context) const;
private:
int fid_; // conceptually const; mutable only to simplify constructor
//LanguageModelImpl &imp() { return *(LanguageModelImpl*)pimpl_; }
LanguageModelImpl & imp() const { return *(LanguageModelImpl*)pimpl_; }
/* mutable */ LanguageModelInterface* pimpl_;
};
#ifdef HAVE_RANDLM
class LanguageModelRandLM : public FeatureFunction {
public:
// param = "filename.lm [-o n]"
LanguageModelRandLM(const std::string& param);
~LanguageModelRandLM();
virtual void FinalTraversalFeatures(const void* context,
SparseVector<double>* features) const;
std::string DebugStateToString(const void* state) const;
protected:
virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
const HG::Edge& edge,
const std::vector<const void*>& ant_contexts,
SparseVector<double>* features,
SparseVector<double>* estimated_features,
void* out_context) const;
private:
const int fid_;
mutable LanguageModelImpl* pimpl_;
};
#endif
#endif
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/codestar/CodeStar_EXPORTS.h>
#include <aws/core/AmazonSerializableWebServiceRequest.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <aws/core/http/HttpRequest.h>
namespace Aws
{
namespace CodeStar
{
class AWS_CODESTAR_API CodeStarRequest : public AmazonSerializableWebServiceRequest
{
public:
virtual ~CodeStarRequest () {}
virtual Aws::String SerializePayload() const override = 0;
void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); }
inline Aws::Http::HeaderValueCollection GetHeaders() const override
{
auto headers = GetRequestSpecificHeaders();
if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0))
{
headers.insert(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, AMZN_JSON_CONTENT_TYPE_1_1 ));
}
return headers;
}
protected:
virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); }
};
} // namespace CodeStar
} // namespace Aws
|
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SCREENRECORD_PROGRAM_H
#define SCREENRECORD_PROGRAM_H
#include <utils/Errors.h>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
namespace android {
/*
* Utility class for GLES rendering.
*
* Not thread-safe.
*/
class Program {
public:
enum ProgramType { PROGRAM_UNKNOWN=0, PROGRAM_EXTERNAL_TEXTURE,
PROGRAM_TEXTURE_2D };
Program() :
mProgramType(PROGRAM_UNKNOWN),
mProgram(0),
maPositionLoc(0),
maTextureCoordLoc(0),
muMVPMatrixLoc(0),
muGLCMatrixLoc(0),
muTextureLoc(0)
{}
~Program() { release(); }
// Initialize the program for use with the specified texture type.
status_t setup(ProgramType type);
// Release the program and associated resources.
void release();
// Blit the specified texture to { x, y, x+w, y+h }.
status_t blit(GLuint texName, const float* texMatrix,
int32_t x, int32_t y, int32_t w, int32_t h) const;
// Draw a number of triangles.
status_t drawTriangles(GLuint texName, const float* texMatrix,
const float* vertices, const float* texes, size_t count) const;
static const float kIdentity[];
private:
Program(const Program&);
Program& operator=(const Program&);
// Common code for draw functions.
status_t beforeDraw(GLuint texName, const float* texMatrix,
const float* vertices, const float* texes) const;
status_t afterDraw() const;
// GLES 2 shader utilities.
status_t createProgram(GLuint* outPgm, const char* vertexShader,
const char* fragmentShader);
static status_t compileShader(GLenum shaderType, const char* src,
GLuint* outShader);
static status_t linkShaderProgram(GLuint vs, GLuint fs, GLuint* outPgm);
ProgramType mProgramType;
GLuint mProgram;
GLint maPositionLoc;
GLint maTextureCoordLoc;
GLint muMVPMatrixLoc;
GLint muGLCMatrixLoc;
GLint muTextureLoc;
};
}; // namespace android
#endif /*SCREENRECORD_PROGRAM_H*/
|
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MLPERF_SUBMISSIONS_TRAINING_V0_7_MODELS_PROD_MINIGO_CC_DUAL_NET_RANDOM_DUAL_NET_H_
#define MLPERF_SUBMISSIONS_TRAINING_V0_7_MODELS_PROD_MINIGO_CC_DUAL_NET_RANDOM_DUAL_NET_H_
#include <array>
#include "REDACTEDsynchronization/mutex.h"
#include "REDACTEDsubmissions/training/v0_7/models/prod/minigo/cc/model/factory.h"
#include "REDACTEDsubmissions/training/v0_7/models/prod/minigo/cc/model/model.h"
#include "REDACTEDsubmissions/training/v0_7/models/prod/minigo/cc/random.h"
namespace minigo {
class RandomDualNet : public Model {
public:
// It may seem weird to require a feature type for RandomDual net since it
// doesn't actually read the input features but once a game finises, we will
// need to know which features to serialize as training examples.
RandomDualNet(std::string name, const FeatureDescriptor& feature_desc,
uint64_t seed, float policy_stddev, float value_stddev);
// Output policy is a normal distribution with a mean of 0.5 and a standard
// deviation of policy_stddev, followed by a softmax.
// Output value is a normal distribution with a mean of 0 and a standard
// deviation of value_stddev. The output value is repeatedly sampled from the
// normal distribution until a value is found in the range [-1, 1].
void RunMany(const std::vector<const ModelInput*>& inputs,
std::vector<ModelOutput*>* outputs,
std::string* model_name) override;
private:
Random rnd_;
const float policy_stddev_;
const float value_stddev_;
};
class RandomDualNetFactory : public ModelFactory {
public:
std::unique_ptr<Model> NewModel(const ModelDefinition& def) override;
};
} // namespace minigo
#endif // MLPERF_SUBMISSIONS_TRAINING_V0_7_MODELS_PROD_MINIGO_CC_DUAL_NET_RANDOM_DUAL_NET_H_
|
#include <stdlib.h>
#include <stdio.h>
#include "lib/config.h"
#include "renderers/image/image.h"
void init_image(CONFIG_SECTION *sect, struct image *image, const char *prefix) {
char tmp[256];
image->prefix = prefix;
snprintf(tmp, sizeof (tmp), "%s.enabled", prefix);
config_getBooleanParameter(sect, tmp, &image->enabled);
snprintf(tmp, sizeof (tmp), "%s.width", prefix);
config_getIntParameter(sect, tmp, &image->width);
snprintf(tmp, sizeof (tmp), "%s.height", prefix);
config_getIntParameter(sect, tmp, &image->height);
snprintf(tmp, sizeof (tmp), "%s.ident", prefix);
config_getCharParameter(sect, tmp, &image->ident);
snprintf(tmp, sizeof (tmp), "%s.path", prefix);
config_getCharParameter(sect, tmp, &image->path);
}
|
/*
* author: Thomas Yao
*/
#ifndef _FIELDS_WRITER_H_
#define _FIELDS_WRITER_H_
#include "field_info.h"
#include "../store/file_stream.h"
struct _fields_writer
{
struct _field_infos* fieldinfos;
struct _file_stream* fieldsstream;
struct _file_stream* indexstream;
};
struct _fields_writer*
fields_writer_initial(struct _directory* dir, char* segment,
struct _field_infos* fis);
void
fields_writer_add_document(struct _fields_writer* _fw, struct _document* _doc);
void
fields_writer_close();
#endif
|
//
// FriendsTableViewController.h
// FacebookMap
//
// Created by Tom Kraina on 14.09.2012.
// Copyright (c) 2012 tomkraina.com. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
@class MapViewController;
@class FileCache;
@interface FriendsTableViewController : UITableViewController <NSFetchedResultsControllerDelegate>
@property (strong, nonatomic) MapViewController *detailViewController;
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (strong, nonatomic, readonly) FileCache *cache;
- (void)startFetchingUsersIntoCoreData;
@end
|
#ifndef APPODEAL_DEBUG_H
#define APPODEAL_DEBUG_H
#include "soa/service/service_utils.h"
#include "soa/service/service_base.h"
#include "soa/service/json_endpoint.h"
#include "soa/service/zmq_named_pub_sub.h"
#include "rtbkit/plugins/adserver/http_adserver_connector.h"
#include "rtbkit/common/auction_events.h"
namespace appodeal_debud {
const std::string bid_sample_filename("/home/fil/rtbkit/rtbkit/plugins/exchange/testing/appodealtestresponse.json");
const std::string bid_sample_filename1("/home/fil/rtbkit/rtbkit/plugins/exchange/testing/appodealtestresponse2.json");
std::string loadFile(const std::string & filename);
long int unix_timestamp();
}
#endif // APPODEAL_DEBUG_H
|
//===- ShellUtility.h -------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef LLBUILD_BASIC_SHELLUTILITY_H
#define LLBUILD_BASIC_SHELLUTILITY_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <vector>
namespace llbuild {
namespace basic {
#if defined(_WIN32)
/// Formats a command line using the Windows command line escaping rules a la a
/// reverse CommandLineToArgVW
///
/// \param args The arugments to escape
///
std::string formatWindowsCommandString(std::vector<std::string> args);
#endif
/// Appends a shell escaped string to an output stream.
/// For e.g. hello -> hello, hello$world -> 'hello$world', input A -> 'input A'
///
/// \param os Reference of the output stream to append to.
///
/// \param string The string to be escaped and appended.
///
void appendShellEscapedString(llvm::raw_ostream& os, llvm::StringRef string);
/// Creates and returns a shell escaped string of the input.
///
/// \param string The string to be escaped.
///
/// \returns escaped string.
std::string shellEscaped(llvm::StringRef string);
}
}
#endif
|
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]){
FILE* file = fopen(argv[1], "r");
FILE* outFile;
char tmpBuf[100];
if (argc == 3){
outFile = fopen(argv[2], "w");
}
while ( fgets(tmpBuf, sizeof tmpBuf, file) ){
if (argc == 3){
if (strstr(tmpBuf, "\r\n") == NULL){
int endChar = strlen(tmpBuf);
tmpBuf[endChar-1] = '\r';
tmpBuf[endChar] = '\n';
tmpBuf[endChar+1] = '\0';
}
fprintf(outFile, "%s", tmpBuf);
}
char outputBuf[200];
int len = strlen(tmpBuf);
int cnt = 0;
for (int i = 0; i < len; i++){
if (tmpBuf[i] == '\r'){
outputBuf[cnt] = '\\';
cnt += 1;
outputBuf[cnt] = 'r';
}else if(tmpBuf[i] == '\n'){
outputBuf[cnt] = '\\';
cnt += 1;
outputBuf[cnt] = 'n';
}else{
outputBuf[cnt] = tmpBuf[i];
}
cnt += 1;
}
outputBuf[cnt] = '\0';
printf("%s\n", outputBuf);
}
fclose(file);
if (argc == 3){
fclose(outFile);
}
return 0;
}
|
/*
* Copyright (C) 2011-2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _AESM_LOGIC_H_
#define _AESM_LOGIC_H_
#include "sgx_urts.h"
#include "aesm_error.h"
#include "arch.h"
#include "aeerror.h"
#include "tlv_common.h"
#include "se_thread.h"
#include "internal/se_stdio.h"
#include "internal/se_memcpy.h"
#include "internal/uncopyable.h"
#include "oal/oal.h"
#include <time.h>
#include <string.h>
#include "se_wrapper.h"
#include "upse/platform_info_blob.h"
#include "default_url_info.hh"
/*File to declare AESMLogic Class */
const uint32_t THREAD_TIMEOUT = 5000;
class AESMLogicMutex{
CLASS_UNCOPYABLE(AESMLogicMutex)
public:
AESMLogicMutex() {se_mutex_init(&mutex);}
~AESMLogicMutex() { se_mutex_destroy(&mutex);}
void lock() { se_mutex_lock(&mutex); }
void unlock() { se_mutex_unlock(&mutex); }
private:
se_mutex_t mutex;
};
class AESMLogicLock {
CLASS_UNCOPYABLE(AESMLogicLock)
public:
explicit AESMLogicLock(AESMLogicMutex& cs) :_cs(cs) { _cs.lock(); }
~AESMLogicLock() { _cs.unlock(); }
private:
AESMLogicMutex& _cs;
};
#define QE_PROD_ID 1
#define PSE_PROD_ID 2
typedef struct _endpoint_selection_infos_t endpoint_selection_infos_t;
class AESMLogic{
public:
static AESMLogicMutex _qe_pve_mutex, _pse_mutex, _le_mutex; /*mutex to lock external interface*/
private:
static psvn_t _qe_psvn, _pse_psvn; /*two different cpu svn used although they're same. We should only access qe_psvn when qe_pve_mutex is acquired and only access pse_psvn when pse_mutext is acquired*/
static bool _is_qe_psvn_set, _is_pse_psvn_set;
static ae_error_t set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn);
static ae_error_t save_unverified_white_list(const uint8_t *white_list_cert, uint32_t white_list_cert_size);
public:
static ae_error_t get_qe_isv_svn(uint16_t& isv_svn);/*This function should only be called when _qe_pve_mutex is acquired*/
static ae_error_t get_qe_cpu_svn(sgx_cpu_svn_t& cpu_svn);/*This function should only be called when _qe_pve_mutex is acquired*/
static ae_error_t get_pse_isv_svn(uint16_t& isv_svn); /*This function should only be called when _pse_mutex is acquired*/
static ae_error_t get_pse_cpu_svn(sgx_cpu_svn_t& cpu_svn);/*This function should only be called when _pse_mutex is acquired*/
static ae_error_t service_start();
static void service_stop();
static bool is_service_running();
static sgx_status_t get_launch_token(const enclave_css_t* signature,
const sgx_attributes_t* attribute,
sgx_launch_token_t* launch_token);
static aesm_error_t get_launch_token(
const uint8_t *mrenclave, uint32_t mrenclave_size,
const uint8_t *public_key, uint32_t public_key_size,
const uint8_t *se_attributes, uint32_t se_attributes_size,
uint8_t * lictoken, uint32_t lictoken_size);
static aesm_error_t init_quote(uint8_t *target_info, uint32_t target_info_size,
uint8_t *gid, uint32_t gid_size);
static aesm_error_t get_quote(const uint8_t *report, uint32_t report_size,
uint32_t quote_type,
const uint8_t *spid, uint32_t spid_size,
const uint8_t *nonce, uint32_t nonce_size,
const uint8_t *sigrl, uint32_t sigrl_size,
uint8_t *qe_report, uint32_t qe_report_size,
uint8_t *quote, uint32_t buf_size);
static aesm_error_t create_session(
uint32_t* session_id,
uint8_t* se_dh_msg1, uint32_t se_dh_msg1_size);
static aesm_error_t exchange_report(
uint32_t session_id,
const uint8_t* se_dh_msg2, uint32_t se_dh_msg2_size,
uint8_t* se_dh_msg3, uint32_t se_dh_msg3_size);
static aesm_error_t close_session(
uint32_t session_id);
static aesm_error_t invoke_service(
const uint8_t* pse_message_req, uint32_t pse_message_req_size,
uint8_t* pse_message_resp, uint32_t pse_message_resp_size);
static aesm_error_t get_ps_cap(
uint64_t* ps_cap);
static uint32_t endpoint_selection(endpoint_selection_infos_t& es_info);
static aesm_error_t report_attestation_status(
uint8_t* platform_info, uint32_t platform_info_size,
uint32_t attestation_status,
uint8_t* update_info, uint32_t update_info_size);
static aesm_error_t white_list_register(
const uint8_t *white_list_cert, uint32_t white_list_cert_size);
};
#endif
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by Felicidades, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#ifdef USE_TI_FACEBOOK
#import "TiViewProxy.h"
#import "FacebookModule.h"
#import "TiFacebookLoginButton.h"
@interface TiFacebookLoginButtonProxy : TiViewProxy {
FacebookModule *module;
}
-(id)_initWithPageContext:(id<TiEvaluator>)context_ args:(id)args module:(FacebookModule*)module_;
@property(nonatomic,readonly) FacebookModule *_module;
-(void)internalSetWidth:(id)width;
-(void)internalSetHeight:(id)height;
@end
#endif |
/* Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifndef NSYNC_PLATFORM_IA64_CPUTYPE_H_
#define NSYNC_PLATFORM_IA64_CPUTYPE_H_
#define ATM_LD_IS_ACQ_ST_IS_REL_ 0
#endif /*NSYNC_PLATFORM_IA64_CPUTYPE_H_*/
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/fsx/FSx_EXPORTS.h>
#include <aws/fsx/FSxRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
#include <aws/core/utils/UUID.h>
namespace Aws
{
namespace FSx
{
namespace Model
{
/**
*/
class AWS_FSX_API DeleteSnapshotRequest : public FSxRequest
{
public:
DeleteSnapshotRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "DeleteSnapshot"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
inline const Aws::String& GetClientRequestToken() const{ return m_clientRequestToken; }
inline bool ClientRequestTokenHasBeenSet() const { return m_clientRequestTokenHasBeenSet; }
inline void SetClientRequestToken(const Aws::String& value) { m_clientRequestTokenHasBeenSet = true; m_clientRequestToken = value; }
inline void SetClientRequestToken(Aws::String&& value) { m_clientRequestTokenHasBeenSet = true; m_clientRequestToken = std::move(value); }
inline void SetClientRequestToken(const char* value) { m_clientRequestTokenHasBeenSet = true; m_clientRequestToken.assign(value); }
inline DeleteSnapshotRequest& WithClientRequestToken(const Aws::String& value) { SetClientRequestToken(value); return *this;}
inline DeleteSnapshotRequest& WithClientRequestToken(Aws::String&& value) { SetClientRequestToken(std::move(value)); return *this;}
inline DeleteSnapshotRequest& WithClientRequestToken(const char* value) { SetClientRequestToken(value); return *this;}
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline const Aws::String& GetSnapshotId() const{ return m_snapshotId; }
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline bool SnapshotIdHasBeenSet() const { return m_snapshotIdHasBeenSet; }
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline void SetSnapshotId(const Aws::String& value) { m_snapshotIdHasBeenSet = true; m_snapshotId = value; }
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline void SetSnapshotId(Aws::String&& value) { m_snapshotIdHasBeenSet = true; m_snapshotId = std::move(value); }
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline void SetSnapshotId(const char* value) { m_snapshotIdHasBeenSet = true; m_snapshotId.assign(value); }
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline DeleteSnapshotRequest& WithSnapshotId(const Aws::String& value) { SetSnapshotId(value); return *this;}
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline DeleteSnapshotRequest& WithSnapshotId(Aws::String&& value) { SetSnapshotId(std::move(value)); return *this;}
/**
* <p>The ID of the snapshot that you want to delete.</p>
*/
inline DeleteSnapshotRequest& WithSnapshotId(const char* value) { SetSnapshotId(value); return *this;}
private:
Aws::String m_clientRequestToken;
bool m_clientRequestTokenHasBeenSet;
Aws::String m_snapshotId;
bool m_snapshotIdHasBeenSet;
};
} // namespace Model
} // namespace FSx
} // namespace Aws
|
//
// AppDelegate.h
// NavigationBarDemo
//
// Created by Simon on 1/10/13.
// Copyright (c) 2013 Appcoda. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef __PHI_POPMENU__
#define __PHI_POPMENU__
#include "../ptk/ptk.h"
PtkMenu *phi_popmenu_new();
#endif
|
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include "TetrisDrawer.h"
#include "TetriminoManager.h"
#include "TetriminoMover.h"
#include "Board.h"
#include "BoardLineManager.h"
#include "TetrisSoundPlayer.h"
class TetrisGame
{
private:
Board * board;
BoardLineManager lineMngr;
TetriminoManager mngr;
sf::RenderWindow * window;
Tetrimino * current, * next;
float waitTimeMilliseconds;
TetriminoPosition currentPosition;
TetriminoMover mover;
short winHeight, winWidth, level;
int score;
TetrisDrawer * drawer;
sf::Clock gameClock;
TetrisSoundPlayer soundPlayer;
bool gameResourcesLoadedCorrectly; //Both graphics and sounds..
const short LINES_TO_NEXT_LEVEL = 10,
SCORE_PER_LINE = 10;
const float TIME_DECREASE_PROPORTION = 0.1f,
WINDOW_ASPECT_RATIO = 4.f/3.f;
//Increase level
void nextLevel();
//Update the score
void updateScore(short lines);
void nextTetriminos();
public:
TetrisGame();
~TetrisGame();
//Start a new game of tetris, principal method (controlling I/O)
void startGame();
bool resourcesLoadedCorrectly();
};
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "syscfg/syscfg.h"
#include "testutil/testutil.h"
#include "test_json.h"
TEST_CASE_DECL(test_json_simple_encode);
TEST_CASE_DECL(test_json_simple_decode);
TEST_SUITE(test_json_suite) {
test_json_simple_encode();
test_json_simple_decode();
}
#if MYNEWT_VAL(SELFTEST)
int
main(int argc, char **argv)
{
ts_config.ts_print_results = 1;
tu_init();
test_json_suite();
return tu_any_failed;
}
#endif
|
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <type_traits>
#include <folly/Likely.h>
#include <folly/Synchronized.h>
#include <folly/ThreadLocal.h>
#include <folly/memory/Arena.h>
namespace folly {
/**
* Thread-caching arena: allocate memory which gets freed when the arena gets
* destroyed.
*
* The arena itself allocates memory using malloc() in blocks of
* at least minBlockSize bytes.
*
* For speed, each thread gets its own Arena (see Arena.h); when threads
* exit, the Arena gets merged into a "zombie" Arena, which will be deallocated
* when the ThreadCachedArena object is destroyed.
*/
class ThreadCachedArena {
public:
explicit ThreadCachedArena(
size_t minBlockSize = SysArena::kDefaultMinBlockSize,
size_t maxAlign = SysArena::kDefaultMaxAlign);
void* allocate(size_t size) {
SysArena* arena = arena_.get();
if (UNLIKELY(!arena)) {
arena = allocateThreadLocalArena();
}
return arena->allocate(size);
}
void deallocate(void* /* p */, size_t = 0) {
// Deallocate? Never!
}
// Gets the total memory used by the arena
size_t totalSize() const;
private:
struct ThreadLocalPtrTag {};
ThreadCachedArena(const ThreadCachedArena&) = delete;
ThreadCachedArena(ThreadCachedArena&&) = delete;
ThreadCachedArena& operator=(const ThreadCachedArena&) = delete;
ThreadCachedArena& operator=(ThreadCachedArena&&) = delete;
SysArena* allocateThreadLocalArena();
// Zombify the blocks in arena, saving them for deallocation until
// the ThreadCachedArena is destroyed.
void zombify(SysArena&& arena);
const size_t minBlockSize_;
const size_t maxAlign_;
ThreadLocalPtr<SysArena, ThreadLocalPtrTag> arena_; // Per-thread arena.
// Allocations from threads that are now dead.
Synchronized<SysArena> zombies_;
};
template <>
struct AllocatorHasTrivialDeallocate<ThreadCachedArena> : std::true_type {};
template <typename T>
using ThreadCachedArenaAllocator = CxxAllocatorAdaptor<T, ThreadCachedArena>;
} // namespace folly
|
/*
* Copyright (C) 2015 University of Oregon
*
* You may distribute under the terms of either the GNU General Public
* License or the Apache License, as specified in the LICENSE file.
*
* For more information, see the LICENSE file.
*/
/*
*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class VNMRFrame */
#ifndef _Included_VNMRFrame
#define _Included_VNMRFrame
#ifdef __cplusplus
extern "C" {
#endif
#undef VNMRFrame_FOCUS_TRAVERSABLE_UNKNOWN
#define VNMRFrame_FOCUS_TRAVERSABLE_UNKNOWN 0L
#undef VNMRFrame_FOCUS_TRAVERSABLE_DEFAULT
#define VNMRFrame_FOCUS_TRAVERSABLE_DEFAULT 1L
#undef VNMRFrame_FOCUS_TRAVERSABLE_SET
#define VNMRFrame_FOCUS_TRAVERSABLE_SET 2L
/* Inaccessible static: focusTraversalKeyPropertyNames */
/* Inaccessible static: LOCK */
/* Inaccessible static: dbg */
/* Inaccessible static: isInc */
/* Inaccessible static: incRate */
#undef VNMRFrame_TOP_ALIGNMENT
#define VNMRFrame_TOP_ALIGNMENT 0.0f
#undef VNMRFrame_CENTER_ALIGNMENT
#define VNMRFrame_CENTER_ALIGNMENT 0.5f
#undef VNMRFrame_BOTTOM_ALIGNMENT
#define VNMRFrame_BOTTOM_ALIGNMENT 1.0f
#undef VNMRFrame_LEFT_ALIGNMENT
#define VNMRFrame_LEFT_ALIGNMENT 0.0f
#undef VNMRFrame_RIGHT_ALIGNMENT
#define VNMRFrame_RIGHT_ALIGNMENT 1.0f
#undef VNMRFrame_serialVersionUID
#define VNMRFrame_serialVersionUID -7644114512714619750LL
/* Inaccessible static: metrics */
/* Inaccessible static: class_00024java_00024awt_00024Component */
/* Inaccessible static: class_00024java_00024awt_00024event_00024ComponentListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024FocusListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024HierarchyListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024HierarchyBoundsListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024KeyListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024MouseListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024MouseMotionListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024MouseWheelListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024InputMethodListener */
/* Inaccessible static: class_00024java_00024beans_00024PropertyChangeListener */
#undef VNMRFrame_serialVersionUID
#define VNMRFrame_serialVersionUID 4613797578919906343LL
/* Inaccessible static: dbg */
#undef VNMRFrame_INCLUDE_SELF
#define VNMRFrame_INCLUDE_SELF 1L
#undef VNMRFrame_SEARCH_HEAVYWEIGHTS
#define VNMRFrame_SEARCH_HEAVYWEIGHTS 1L
/* Inaccessible static: class_00024java_00024awt_00024Container */
/* Inaccessible static: class_00024java_00024awt_00024event_00024ContainerListener */
/* Inaccessible static: systemSyncLWRequests */
#undef VNMRFrame_OPENED
#define VNMRFrame_OPENED 1L
/* Inaccessible static: nameCounter */
#undef VNMRFrame_serialVersionUID
#define VNMRFrame_serialVersionUID 4497834738069338734LL
/* Inaccessible static: dbg */
/* Inaccessible static: class_00024java_00024awt_00024Window */
/* Inaccessible static: class_00024java_00024awt_00024event_00024WindowListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024WindowFocusListener */
/* Inaccessible static: class_00024java_00024awt_00024event_00024WindowStateListener */
#undef VNMRFrame_DEFAULT_CURSOR
#define VNMRFrame_DEFAULT_CURSOR 0L
#undef VNMRFrame_CROSSHAIR_CURSOR
#define VNMRFrame_CROSSHAIR_CURSOR 1L
#undef VNMRFrame_TEXT_CURSOR
#define VNMRFrame_TEXT_CURSOR 2L
#undef VNMRFrame_WAIT_CURSOR
#define VNMRFrame_WAIT_CURSOR 3L
#undef VNMRFrame_SW_RESIZE_CURSOR
#define VNMRFrame_SW_RESIZE_CURSOR 4L
#undef VNMRFrame_SE_RESIZE_CURSOR
#define VNMRFrame_SE_RESIZE_CURSOR 5L
#undef VNMRFrame_NW_RESIZE_CURSOR
#define VNMRFrame_NW_RESIZE_CURSOR 6L
#undef VNMRFrame_NE_RESIZE_CURSOR
#define VNMRFrame_NE_RESIZE_CURSOR 7L
#undef VNMRFrame_N_RESIZE_CURSOR
#define VNMRFrame_N_RESIZE_CURSOR 8L
#undef VNMRFrame_S_RESIZE_CURSOR
#define VNMRFrame_S_RESIZE_CURSOR 9L
#undef VNMRFrame_W_RESIZE_CURSOR
#define VNMRFrame_W_RESIZE_CURSOR 10L
#undef VNMRFrame_E_RESIZE_CURSOR
#define VNMRFrame_E_RESIZE_CURSOR 11L
#undef VNMRFrame_HAND_CURSOR
#define VNMRFrame_HAND_CURSOR 12L
#undef VNMRFrame_MOVE_CURSOR
#define VNMRFrame_MOVE_CURSOR 13L
#undef VNMRFrame_NORMAL
#define VNMRFrame_NORMAL 0L
#undef VNMRFrame_ICONIFIED
#define VNMRFrame_ICONIFIED 1L
#undef VNMRFrame_MAXIMIZED_HORIZ
#define VNMRFrame_MAXIMIZED_HORIZ 2L
#undef VNMRFrame_MAXIMIZED_VERT
#define VNMRFrame_MAXIMIZED_VERT 4L
#undef VNMRFrame_MAXIMIZED_BOTH
#define VNMRFrame_MAXIMIZED_BOTH 6L
/* Inaccessible static: nameCounter */
#undef VNMRFrame_serialVersionUID
#define VNMRFrame_serialVersionUID 2673458971256075116LL
/* Inaccessible static: class_00024java_00024awt_00024Frame */
#undef VNMRFrame_EXIT_ON_CLOSE
#define VNMRFrame_EXIT_ON_CLOSE 3L
/* Inaccessible static: defaultLookAndFeelDecoratedKey */
/* Inaccessible static: updateAttrThread */
/* Inaccessible static: updateThread */
/* Inaccessible static: fillMacrosThread */
/* Inaccessible static: fillWorkspaceThread */
/* Inaccessible static: dbStatus */
/* Inaccessible static: hostAddr */
/* Inaccessible static: vnmrFrame */
/* Inaccessible static: m_title */
/*
* Class: VNMRFrame
* Method: getXwinId
* Signature: (Ljavax/swing/JFrame;)I
*/
JNIEXPORT jint JNICALL Java_vnmr_ui_VNMRFrame_getXwinId
(JNIEnv *, jobject, jobject);
/*
* Class: VNMRFrame
* Method: syncXwin
* Signature: (Ljavax/swing/JFrame;)I
*/
JNIEXPORT jint JNICALL Java_vnmr_ui_VNMRFrame_syncXwin
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif
|
/**
* A class which describes the properties and actions of an action. An actions
* is defined as an entity which will trigger a specific feature of a device
* with a (optional) parameter.
*
* @date Jul 20, 2014
* @author Joeri HERMANS
* @version 0.1
*
* Copyright 2013 Joeri HERMANS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ACTION_H_
#define ACTION_H_
// BEGIN Includes. ///////////////////////////////////////////////////
// System dependencies.
#include <string>
// END Includes. /////////////////////////////////////////////////////
class Action {
public:
// BEGIN Class constants. ////////////////////////////////////////
// END Class constants. //////////////////////////////////////////
private:
// BEGIN Private members. ////////////////////////////////////////
/**
* Contains the feature identifier of the action.
*/
std::string mIdentifier;
/**
* Contains the parameter of the action.
*/
std::string mParameter;
// END Private members. //////////////////////////////////////////
// BEGIN Private methods. ////////////////////////////////////////
void setIdentifier( const std::string & identifier );
void setParameter( const std::string & parameter );
// END Private methods. //////////////////////////////////////////
protected:
// BEGIN Protected methods. //////////////////////////////////////
// END Protected methods. ////////////////////////////////////////
public:
// BEGIN Constructors. ///////////////////////////////////////////
Action( const std::string & identifier );
Action( const std::string & identifier,
const std::string & parameter );
// END Constructors. /////////////////////////////////////////////
// BEGIN Destructor. /////////////////////////////////////////////
virtual ~Action( void );
// END Destructor. ///////////////////////////////////////////////
// BEGIN Public methods. /////////////////////////////////////////
/**
* Returns the unique identifier of the device which is associated with
* the action.
*
* @return The device identifier.
*/
const std::string & getIdentifier( void ) const;
/**
* Checks if the action has a parameter.
*
* @return True, if the parameter field isn't the empty string. False in
* any other case.
*/
bool containsParameter( void ) const;
/**
* Returns the parameter of the action.
*
* @return The action parameter.
*/
const std::string & getParameter( void ) const;
// END Public methods. ///////////////////////////////////////////
// BEGIN Static methods. /////////////////////////////////////////
// END Static methods. ///////////////////////////////////////////
};
#endif /* ACTION_H_ */
|
/*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VR180_CPP_VIDEO_FORMAT_ATOMS_ATOM_MOOV_H_
#define VR180_CPP_VIDEO_FORMAT_ATOMS_ATOM_MOOV_H_
#include <cstdint>
#include <string>
#include <vector>
#include "cpp/video/atom.h"
#include "cpp/video/atoms/atom_trak.h"
#include "cpp/video/binary_reader.h"
#include "cpp/video/binary_writer.h"
namespace vr180 {
// The Movie atom is a top-level atom along with FTYP and MDAT. There must be
// exactly one MOOV in each mp4 file. MOOV contains one MVHD, zero or one IODS,
// and one or more TRAK atoms.
//
// ISO/IEC 14496-12 Section 8.1
class AtomMOOV : public Atom {
public:
AtomMOOV(const AtomSize header_size, const AtomSize data_size,
const std::string& atom_type);
AtomMOOV();
// Returns all the tracks in this atom.
std::vector<AtomTRAK*> tracks() const;
// Returns the 1st video track.
AtomTRAK* GetFirstVideoTrack() const;
};
} // namespace vr180
#endif // VR180_CPP_VIDEO_FORMAT_ATOMS_ATOM_MOOV_H_
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/iotanalytics/IoTAnalytics_EXPORTS.h>
#include <aws/iotanalytics/IoTAnalyticsRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace IoTAnalytics
{
namespace Model
{
/**
*/
class AWS_IOTANALYTICS_API CancelPipelineReprocessingRequest : public IoTAnalyticsRequest
{
public:
CancelPipelineReprocessingRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "CancelPipelineReprocessing"; }
Aws::String SerializePayload() const override;
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline const Aws::String& GetPipelineName() const{ return m_pipelineName; }
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline bool PipelineNameHasBeenSet() const { return m_pipelineNameHasBeenSet; }
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline void SetPipelineName(const Aws::String& value) { m_pipelineNameHasBeenSet = true; m_pipelineName = value; }
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline void SetPipelineName(Aws::String&& value) { m_pipelineNameHasBeenSet = true; m_pipelineName = std::move(value); }
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline void SetPipelineName(const char* value) { m_pipelineNameHasBeenSet = true; m_pipelineName.assign(value); }
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline CancelPipelineReprocessingRequest& WithPipelineName(const Aws::String& value) { SetPipelineName(value); return *this;}
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline CancelPipelineReprocessingRequest& WithPipelineName(Aws::String&& value) { SetPipelineName(std::move(value)); return *this;}
/**
* <p>The name of pipeline for which data reprocessing is canceled.</p>
*/
inline CancelPipelineReprocessingRequest& WithPipelineName(const char* value) { SetPipelineName(value); return *this;}
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline const Aws::String& GetReprocessingId() const{ return m_reprocessingId; }
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline bool ReprocessingIdHasBeenSet() const { return m_reprocessingIdHasBeenSet; }
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline void SetReprocessingId(const Aws::String& value) { m_reprocessingIdHasBeenSet = true; m_reprocessingId = value; }
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline void SetReprocessingId(Aws::String&& value) { m_reprocessingIdHasBeenSet = true; m_reprocessingId = std::move(value); }
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline void SetReprocessingId(const char* value) { m_reprocessingIdHasBeenSet = true; m_reprocessingId.assign(value); }
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline CancelPipelineReprocessingRequest& WithReprocessingId(const Aws::String& value) { SetReprocessingId(value); return *this;}
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline CancelPipelineReprocessingRequest& WithReprocessingId(Aws::String&& value) { SetReprocessingId(std::move(value)); return *this;}
/**
* <p>The ID of the reprocessing task (returned by
* "StartPipelineReprocessing").</p>
*/
inline CancelPipelineReprocessingRequest& WithReprocessingId(const char* value) { SetReprocessingId(value); return *this;}
private:
Aws::String m_pipelineName;
bool m_pipelineNameHasBeenSet;
Aws::String m_reprocessingId;
bool m_reprocessingIdHasBeenSet;
};
} // namespace Model
} // namespace IoTAnalytics
} // namespace Aws
|
#pragma once
#include <chrono>
#include "envoy/api/api.h"
#include "envoy/config/core/v3/health_check.pb.h"
#include "envoy/config/health_checker/redis/v2/redis.pb.h"
#include "envoy/data/core/v3/health_check_event.pb.h"
#include "envoy/extensions/filters/network/redis_proxy/v3/redis_proxy.pb.h"
#include "envoy/extensions/filters/network/redis_proxy/v3/redis_proxy.pb.validate.h"
#include "common/upstream/health_checker_base_impl.h"
#include "extensions/filters/network/common/redis/client_impl.h"
#include "extensions/filters/network/redis_proxy/config.h"
#include "extensions/filters/network/redis_proxy/conn_pool_impl.h"
namespace Envoy {
namespace Extensions {
namespace HealthCheckers {
namespace RedisHealthChecker {
/**
* Redis health checker implementation. Sends PING and expects PONG.
*/
class RedisHealthChecker : public Upstream::HealthCheckerImplBase {
public:
RedisHealthChecker(
const Upstream::Cluster& cluster, const envoy::config::core::v3::HealthCheck& config,
const envoy::config::health_checker::redis::v2::Redis& redis_config,
Event::Dispatcher& dispatcher, Runtime::Loader& runtime, Random::RandomGenerator& random,
Upstream::HealthCheckEventLoggerPtr&& event_logger, Api::Api& api,
Extensions::NetworkFilters::Common::Redis::Client::ClientFactory& client_factory);
static const NetworkFilters::Common::Redis::RespValue& pingHealthCheckRequest() {
static HealthCheckRequest* request = new HealthCheckRequest();
return request->request_;
}
static const NetworkFilters::Common::Redis::RespValue&
existsHealthCheckRequest(const std::string& key) {
static HealthCheckRequest* request = new HealthCheckRequest(key);
return request->request_;
}
protected:
envoy::data::core::v3::HealthCheckerType healthCheckerType() const override {
return envoy::data::core::v3::REDIS;
}
private:
friend class RedisHealthCheckerTest;
struct RedisActiveHealthCheckSession
: public ActiveHealthCheckSession,
public Extensions::NetworkFilters::Common::Redis::Client::Config,
public Extensions::NetworkFilters::Common::Redis::Client::ClientCallbacks,
public Network::ConnectionCallbacks {
RedisActiveHealthCheckSession(RedisHealthChecker& parent, const Upstream::HostSharedPtr& host);
~RedisActiveHealthCheckSession() override;
// ActiveHealthCheckSession
void onInterval() override;
void onTimeout() override;
void onDeferredDelete() final;
// Extensions::NetworkFilters::Common::Redis::Client::Config
bool disableOutlierEvents() const override { return true; }
std::chrono::milliseconds opTimeout() const override {
// Allow the main Health Check infra to control timeout.
return parent_.timeout_ * 2;
}
bool enableHashtagging() const override { return false; }
bool enableRedirection() const override {
return true;
} // Redirection errors are treated as check successes.
NetworkFilters::Common::Redis::Client::ReadPolicy readPolicy() const override {
return NetworkFilters::Common::Redis::Client::ReadPolicy::Primary;
}
// Batching
unsigned int maxBufferSizeBeforeFlush() const override {
return 0;
} // Forces an immediate flush
std::chrono::milliseconds bufferFlushTimeoutInMs() const override {
return std::chrono::milliseconds(1);
}
uint32_t maxUpstreamUnknownConnections() const override { return 0; }
bool enableCommandStats() const override { return false; }
// Extensions::NetworkFilters::Common::Redis::Client::ClientCallbacks
void onResponse(NetworkFilters::Common::Redis::RespValuePtr&& value) override;
void onFailure() override;
bool onRedirection(NetworkFilters::Common::Redis::RespValuePtr&&, const std::string&,
bool) override;
// Network::ConnectionCallbacks
void onEvent(Network::ConnectionEvent event) override;
void onAboveWriteBufferHighWatermark() override {}
void onBelowWriteBufferLowWatermark() override {}
RedisHealthChecker& parent_;
Extensions::NetworkFilters::Common::Redis::Client::ClientPtr client_;
Extensions::NetworkFilters::Common::Redis::Client::PoolRequest* current_request_{};
Extensions::NetworkFilters::Common::Redis::RedisCommandStatsSharedPtr redis_command_stats_;
};
enum class Type { Ping, Exists };
struct HealthCheckRequest {
HealthCheckRequest(const std::string& key);
HealthCheckRequest();
NetworkFilters::Common::Redis::RespValue request_;
};
using RedisActiveHealthCheckSessionPtr = std::unique_ptr<RedisActiveHealthCheckSession>;
// HealthCheckerImplBase
ActiveHealthCheckSessionPtr makeSession(Upstream::HostSharedPtr host) override {
return std::make_unique<RedisActiveHealthCheckSession>(*this, host);
}
Extensions::NetworkFilters::Common::Redis::Client::ClientFactory& client_factory_;
Type type_;
const std::string key_;
const std::string auth_username_;
const std::string auth_password_;
};
} // namespace RedisHealthChecker
} // namespace HealthCheckers
} // namespace Extensions
} // namespace Envoy
|
//
// Copyright 2014 Etrawler
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
@interface CustomLocationCell : UITableViewCell {
UIImageView *locationIcon;
UILabel *locationNameLabel;
UILabel *locationAddressLabel;
UILabel *locationDistanceLabel;
UIButton *selectBtn;
}
@property (nonatomic, retain) IBOutlet UILabel *locationNameLabel;
@property (nonatomic, retain) IBOutlet UILabel *locationAddressLabel;
@property (nonatomic, retain) IBOutlet UILabel *locationDistanceLabel;
@property (nonatomic, retain) IBOutlet UIButton *selectBtn;
@property (nonatomic, retain) IBOutlet UIImageView *locationIcon;
-(IBAction) cellPressed;
@end
|
#include <stdio.h>
#include <string.h>
#include <psec/encode.h>
#include <psec/hash.h>
int main(void) {
unsigned char msg[] = "test";
unsigned char digest[HASH_DIGEST_SIZE_MD5], encoded_digest[(HASH_DIGEST_SIZE_MD5 * 2) + 1];
size_t out_len = 0;
hash_buffer_md5(digest, msg, strlen((char *) msg));
encode_buffer_base16(encoded_digest, &out_len, digest, HASH_DIGEST_SIZE_MD5);
puts((char *) encoded_digest);
return 0;
}
|
/**
* recipehub APSHTTPClient Library
* Copyright (c) 2009-2016 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import <Foundation/Foundation.h>
@interface APSHTTPHelper : NSObject
+(NSString *)base64encode:(NSData *)plainText;
+(int)caselessCompareFirstString:(const char *)firstString secondString:(const char *)secondString size:(int)size;
+(BOOL)extractEncodingFromData:(NSData *)inputData result:(NSStringEncoding *)result;
+(NSString *)contentTypeForImageData:(NSData *)data;
+(NSString *)fileMIMEType:(NSString *)file;
+(NSString *)encodeURL:(NSString *)string;
+(void)parseMimeType:(NSString **)mimeType andResponseEncoding:(NSStringEncoding *)stringEncoding fromContentType:(NSString *)contentType;
+(NSStringEncoding)parseStringEncodingFromHeaders:(NSDictionary *)headers;
@end
|
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <fftw3.h> /* sudo apt-get install fftw3 -> not enough, go to www.fftw.org */
#include "fftw3real_common.h"
extern const int epsilon;
extern const double* get_x_randreal_64bit( const int dftsize );
extern const double* get_X_randreal_64bit( const int dftsize );
int main( int argc, char ** argv )
{
if (argc < 3)
{
fprintf( stderr, "\nUsage parameters: <N> <NITER> (e.g. 1024 1e5)\n");
return -1;
}
int i;
float tmp;
int N, NITER;
int concise = 1;
sscanf( argv[ 1 ], "%g", &tmp ); /* Permit 1.234e5 notation */
N = (int)(tmp);
sscanf( argv[ 2 ], "%g", &tmp ); /* Permit 1.234e5 notation */
NITER = (int)(tmp);
double * x_in = (double *) malloc( N * sizeof( double ) );
const int N_out = (N >> 1) + 1;
fftw_complex * X = (fftw_complex*) fftw_malloc( N_out * sizeof( fftw_complex ));
const double* x_randreal = get_x_randreal_64bit( N );
const double* X_randreal = get_X_randreal_64bit( N );
if (!x_randreal || !X_randreal)
{
fprintf( stderr, "\nERROR: unrecognized dftsize %d (could not get both x_randreal and X_randreal)\n", N );
return -1;
}
/* Prepare FFTW plan*/
PLAN_DURATION_BEGIN( concise );
fftw_plan p = fftw_plan_dft_r2c_1d(N, x_in, X, FFTW_MEASURE);
PLAN_DURATION_END( concise );
/* Prepare input (need to copy because `x_randreal` has `const`) */
for (i = 0; i < N; i++)
x_in[ i ] = x_randreal[ i ];
/* --- Sanity check --- */
fftw_execute( p );
int ok_all = 1;
for (i = 0; i < N_out; i++)
{
const double* result_i = X[ i ];
const double* expected_i = X_randreal + (i << 1);
double delta_0 = fabs( result_i[ 0 ] - expected_i[ 0 ] );
double delta_1 = fabs( result_i[ 1 ] - expected_i[ 1 ] );
int ok = EPSILON > delta_0 && EPSILON > delta_1;
ok_all &= ok;
}
if (!ok_all)
{
fprintf( stderr, "\nERROR: buggy implementation!\n");
return -1;
}
/* --- Performance test --- */
TEST_DURATION_BEGIN( concise );
for (i = NITER ; i-- ; )
fftw_execute( p );
TEST_DURATION_END( concise );
/* --- Cleanup --- */
free( x_in );
fftw_destroy_plan( p );
fftw_free( X );
/* printf("\nDone.\n"); */
return 0;
}
|
/* IBM_PROLOG_BEGIN_TAG */
/*
* Copyright 2003,2016 IBM International Business Machines Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* IBM_PROLOG_END_TAG */
#include <stdio.h>
#include <string.h>
#include <scsi/sg.h>
#include <scsi/scsi.h>
#include "devinfo.h"
#include <sys/ioctl.h>
#include <linux/hdreg.h>
#include <linux/fs.h>
#include <errno.h>
int htx_ioctl(struct htx_data *data, int d, int request, void *ptr)
{
int i, retval = 0;
char msg[256];
switch(request) {
case IOCINFO:
{
struct devinfo *info = (struct devinfo *) ptr;
unsigned long long disk_size = 0, no_of_blks = 0;
unsigned int sect_sz = 0;
retval = ioctl(d, BLKSSZGET, §_sz);
if(retval < 0) {
return -1;
}
if(sect_sz == 0) {
errno = EINVAL;
return(-1);
}
retval = ioctl(d, BLKGETSIZE64, &disk_size);
if(retval < 0) {
return -1;
}
no_of_blks = (disk_size / sect_sz);
if(no_of_blks & 0x01) {
no_of_blks-- ;
}
printf("sect_sz = %#x, no_of_blks = %#llx \n", sect_sz, no_of_blks);
info->devtype = DD_SCDISK;
info->un.scdk.blksize = (unsigned int) sect_sz;
info->un.scdk.numblks = (unsigned long long ) no_of_blks;
info->un.scdk.max_request = 0;
info->un.scdk.segment_size = 0;
info->un.scdk.segment_count = 0;
info->un.scdk.byte_count = 0;
break;
}
case CHECK_WRITE_CACHE:
{
/* IOCTL output - first 4 bytes will be HEADER, following which
will start mode page data. There will be no Descriptor block
in the output after the header as in cdb we have set the bit
to disable descriptor block i.e. cdb[1]
Below is the format of mode page 8 output data (after skipping first
4 bytes of header):
BYTE | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
------------------------------------------------------|
4 | PS | SPF | PAGE CODE (0x8) |
------------------------------------------------------|
5 | PAGE LENGTH (0x12) |
------------------------------------------------------|
6 | IC | ABPF | CAP | DISC | SIZE | WCE | MF | RCD |
------------------------------------------------------|
WCE bit in 3rd byte i.e. byte[2] will tell whether Write
Cache is enabled for the disk or not.
*/
int WCE_bit = 0;
unsigned char cdb[6] = {MODE_SENSE, DISABLE_DESC_BLOCK, CACHING_MODE_PAGE, 0, MODE_SENSE_REPLY, 0};
unsigned char mode_sense_resp[MODE_SENSE_REPLY];
struct sg_io_hdr io_hdr;
if ((ioctl(d, SG_GET_VERSION_NUM, &i) < 0) || (i < 30000)) {
sprintf(msg, "%s is not a sg device OR older sg driver version\n. Will not run thread for sync_cache", data->sdev_id);
hxfmsg(data, 0, HTX_HE_INFO, msg);
return (-1);
}
memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
io_hdr.interface_id = 'S';
io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
io_hdr.cmdp = cdb;
io_hdr.cmd_len = sizeof(cdb);
io_hdr.dxfer_len = MODE_SENSE_REPLY;
io_hdr.dxferp = mode_sense_resp;
/* printf("cdb: %02x %02x %02x %02x %02x %02x\n", cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5]); */
retval = ioctl(d, SG_IO, &io_hdr);
if (retval < 0) {
sprintf(msg, "MODE_SENSE command to check write cache enablement failed. errno: %d\n"
"Will not run thread for sync_cache", errno);
hxfmsg(data, errno, HTX_HE_INFO, msg);
return (-1);
}
/* printf("SCSI status: %d, host_status: %d, driver_status: %d\n", io_hdr.status, io_hdr.host_status, io_hdr.driver_status);
for (i = 0; i < MODE_SENSE_REPLY; i++) {
printf("%02x ", mode_sense_resp[i]);
}
*/
WCE_bit = (int) ((mode_sense_resp[6] & WCE_MASK) >> WCE_SHIFT);
/* printf("WCE_bit: %d\n", WCE_bit); */
return WCE_bit;
break;
}
case DISCARD:
{
unsigned long long *range;
range = (unsigned long long *) ptr;
retval = ioctl (d, BLKDISCARD, range);
if (retval < 0) {
sprintf(msg, "BLKDISCARD ioctl failed with errno: %d\n", errno);
hxfmsg(data, errno, HTX_HE_INFO, msg);
return retval;
}
break;
}
default:
return -1;
break;
}
return 0;
}
|
/**
* @cond doxygenLibsbmlInternal
*
* @file L2v3CompatibilityValidator.h
* @brief Checks whether an SBML model can be converted from L2v3
* @author Sarah Keating
*
* <!--------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2013-2015 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
* 3. University of Heidelberg, Heidelberg, Germany
*
* Copyright (C) 2009-2013 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution and
* also available online as http://sbml.org/software/libsbml/license.html
* ---------------------------------------------------------------------- -->*/
#ifndef L2v3CompatibilityValidator_h
#define L2v3CompatibilityValidator_h
#ifdef __cplusplus
#include <sbml/validator/Validator.h>
LIBSBML_CPP_NAMESPACE_BEGIN
class L2v3CompatibilityValidator: public Validator
{
public:
L2v3CompatibilityValidator () :
Validator( LIBSBML_CAT_SBML_L2V3_COMPAT ) { }
virtual ~L2v3CompatibilityValidator () { }
/**
* Initializes this Validator with a set of Constraints.
*/
virtual void init ();
};
LIBSBML_CPP_NAMESPACE_END
#endif /* __cplusplus */
#endif /* L2v3CompatibilityValidator_h */
/** @endcond */
|
/**
* Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
#import <UIKit/UIKit.h>
// geopost modification note:
// using categories with static libraries don't seem to work
// right on device with iphone - probably a symbol issue
// turn this into a static function (from what was a category to UIImage
// originally)
UIImage* AddImageReflection(UIImage *src, CGFloat reflectionFraction);
#endif |
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/acm/ACM_EXPORTS.h>
#include <aws/acm/ACMRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace ACM
{
namespace Model
{
/**
*/
class AWS_ACM_API GetCertificateRequest : public ACMRequest
{
public:
GetCertificateRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "GetCertificate"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline const Aws::String& GetCertificateArn() const{ return m_certificateArn; }
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline void SetCertificateArn(const Aws::String& value) { m_certificateArnHasBeenSet = true; m_certificateArn = value; }
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline void SetCertificateArn(Aws::String&& value) { m_certificateArnHasBeenSet = true; m_certificateArn = std::move(value); }
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline void SetCertificateArn(const char* value) { m_certificateArnHasBeenSet = true; m_certificateArn.assign(value); }
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline GetCertificateRequest& WithCertificateArn(const Aws::String& value) { SetCertificateArn(value); return *this;}
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline GetCertificateRequest& WithCertificateArn(Aws::String&& value) { SetCertificateArn(std::move(value)); return *this;}
/**
* <p>String that contains a certificate ARN in the following format:</p> <p>
* <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code>
* </p> <p>For more information about ARNs, see <a
* href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
* Resource Names (ARNs) and AWS Service Namespaces</a>.</p>
*/
inline GetCertificateRequest& WithCertificateArn(const char* value) { SetCertificateArn(value); return *this;}
private:
Aws::String m_certificateArn;
bool m_certificateArnHasBeenSet;
};
} // namespace Model
} // namespace ACM
} // namespace Aws
|
//#//////////////////////////////////////////////
/// Breath-First-Search class.
/// The class is meant for executing many BFSs over a fixed graph. This means that the class can keep the hash tables and queues initialized between different calls of the DoBfs() function.
template<class PGraph>
class TBreathFS_Hybrid {
public:
PGraph Graph;
TInt StartNId;
TIntH NIdDistH;
public:
TBreathFS_Hybrid(const PGraph& GraphPt, const bool& InitBigV=true) :
Graph(GraphPt), NIdDistH(Graph->GetNodes()), InitBigV(InitBigV) {}
/// Performs BFS from node id StartNode for at maps MxDist steps by only following in-links (parameter FollowIn = true) and/or out-links (parameter FollowOut = true).
int DoBfs_Hybrid(const int& StartNode, const bool& FollowOut, const bool& FollowIn, const int& TargetNId=-1, const int& MxDist=TInt::Mx);
private:
bool InitBigV;
int Stage; // 0, 2: top down, 1: bottom up
static const unsigned int alpha = 100;
static const unsigned int beta = 20;
/* Private functions */
bool TopDownStep(TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int& MaxDist, const int& TargetNId, const bool& FollowOut, const bool& FollowIn);
bool BottomUpStep(TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int& MaxDist, const int& TargetNId, const bool& FollowOut, const bool& FollowIn);
};
template<class PGraph>
int TBreathFS_Hybrid<PGraph>::DoBfs_Hybrid(const int& StartNode, const bool& FollowOut, const bool& FollowIn, const int& TargetNId, const int& MxDist) {
StartNId = StartNode;
IAssert(Graph->IsNode(StartNId));
if (TargetNId == StartNode) return 0;
const typename PGraph::TObj::TNodeI StartNodeI = Graph->GetNI(StartNode);
// Initialize vector
TIntV NIdDistV(Graph->GetMxNId() + 1);
for (int i = 0; i < NIdDistV.Len(); i++) {
NIdDistV.SetVal(i, -1);
}
TIntV *Frontier = new TIntV(InitBigV ? Graph->GetNodes() : 1024, 0);
TIntV *NextFrontier = new TIntV(InitBigV ? Graph->GetNodes() : 1024, 0);
NIdDistV.SetVal(StartNId, 0);
Frontier->Add(StartNId);
Stage = 0;
int MaxDist = -1;
const unsigned int TotalNodes = Graph->GetNodes();
unsigned int UnvisitedNodes = Graph->GetNodes();
while (! Frontier->Empty()) {
MaxDist += 1;
NextFrontier->Clr(false);
if (MaxDist == MxDist) { break; } // max distance limit reached
UnvisitedNodes -= Frontier->Len();
if (Stage == 0 && UnvisitedNodes / Frontier->Len() < alpha) {
Stage = 1;
} else if (Stage == 1 && TotalNodes / Frontier->Len() > beta) {
Stage = 2;
}
// Top down or bottom up depending on stage
bool targetFound = false;
if (Stage == 0 || Stage == 2) {
targetFound = TopDownStep(NIdDistV, Frontier, NextFrontier, MaxDist, TargetNId, FollowOut, FollowIn);
} else {
targetFound = BottomUpStep(NIdDistV, Frontier, NextFrontier, MaxDist, TargetNId, FollowOut, FollowIn);
}
if (targetFound) {
MaxDist = NIdDistV[TargetNId];
break;
}
// swap Frontier and NextFrontier
TIntV *temp = Frontier;
Frontier = NextFrontier;
NextFrontier = temp;
}
delete Frontier;
delete NextFrontier;
// Transform vector to hash table
for (int NId = 0; NId < NIdDistV.Len(); NId++) {
if (NIdDistV[NId] != -1) {
NIdDistH.AddDat(NId, NIdDistV[NId]);
}
}
return MaxDist;
}
template<class PGraph>
bool TBreathFS_Hybrid<PGraph>::TopDownStep(TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int& MaxDist, const int& TargetNId, const bool& FollowOut, const bool& FollowIn) {
for (TIntV::TIter it = Frontier->BegI(); it != Frontier->EndI(); ++it) { // loop over frontier
const int NId = *it;
const int Dist = NIdDistV[NId];
IAssert(Dist == MaxDist); // Must equal to MaxDist
const typename PGraph::TObj::TNodeI NodeI = Graph->GetNI(NId);
if (FollowOut) {
for (int v = 0; v < NodeI.GetOutDeg(); v++) {
const int NeighborNId = NodeI.GetOutNId(v);
if (NIdDistV[NeighborNId] == -1) {
NIdDistV.SetVal(NeighborNId, Dist+1);
if (NeighborNId == TargetNId) return true;
NextFrontier->Add(NeighborNId);
}
}
}
if (FollowIn) {
for (int v = 0; v < NodeI.GetInDeg(); v++) {
const int NeighborNId = NodeI.GetInNId(v);
if (NIdDistV[NeighborNId] == -1) {
NIdDistV.SetVal(NeighborNId, Dist+1);
if (NeighborNId == TargetNId) return true;
NextFrontier->Add(NeighborNId);
}
}
}
}
return false;
}
template<class PGraph>
bool TBreathFS_Hybrid<PGraph>::BottomUpStep(TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int& MaxDist, const int& TargetNId, const bool& FollowOut, const bool& FollowIn) {
for (typename PGraph::TObj::TNodeI NodeI = Graph->BegNI(); NodeI < Graph->EndNI(); NodeI++) {
const int NId = NodeI.GetId();
if (NIdDistV[NId] == -1) {
if (FollowOut) {
for (int v = 0; v < NodeI.GetInDeg(); v++) {
const int ParentNId = NodeI.GetInNId(v);
if (NIdDistV[ParentNId] == MaxDist) {
NIdDistV[NId] = MaxDist + 1;
if (NId == TargetNId) return true;
NextFrontier->Add(NId);
break;
}
}
}
if (FollowIn && NIdDistV[NId] == -1) {
for (int v = 0; v < NodeI.GetOutDeg(); v++) {
const int ParentNId = NodeI.GetOutNId(v);
if (NIdDistV[ParentNId] == MaxDist) {
NIdDistV[NId] = MaxDist + 1;
if (NId == TargetNId) return true;
NextFrontier->Add(NId);
break;
}
}
}
}
}
return false;
}
|
// NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// Cloud Trace API (cloudtrace/v2)
// Description:
// Sends application trace data to Cloud Trace for viewing. Trace data is
// collected for all App Engine applications by default. Trace data from other
// applications can be provided using this API. This library is used to
// interact with the Cloud Trace API directly. If you are looking to
// instrument your application for Cloud Trace, we recommend using OpenCensus.
// Documentation:
// https://cloud.google.com/trace
#if SWIFT_PACKAGE || GTLR_USE_MODULAR_IMPORT
@import GoogleAPIClientForRESTCore;
#elif GTLR_BUILT_AS_FRAMEWORK
#import "GTLR/GTLRService.h"
#else
#import "GTLRService.h"
#endif
#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif
// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
NS_ASSUME_NONNULL_BEGIN
// ----------------------------------------------------------------------------
// Authorization scopes
/**
* Authorization scope: See, edit, configure, and delete your Google Cloud data
* and see the email address for your Google Account.
*
* Value "https://www.googleapis.com/auth/cloud-platform"
*/
FOUNDATION_EXTERN NSString * const kGTLRAuthScopeCloudTraceCloudPlatform;
/**
* Authorization scope: Write Trace data for a project or application
*
* Value "https://www.googleapis.com/auth/trace.append"
*/
FOUNDATION_EXTERN NSString * const kGTLRAuthScopeCloudTraceTraceAppend;
// ----------------------------------------------------------------------------
// GTLRCloudTraceService
//
/**
* Service for executing Cloud Trace API queries.
*
* Sends application trace data to Cloud Trace for viewing. Trace data is
* collected for all App Engine applications by default. Trace data from other
* applications can be provided using this API. This library is used to
* interact with the Cloud Trace API directly. If you are looking to instrument
* your application for Cloud Trace, we recommend using OpenCensus.
*/
@interface GTLRCloudTraceService : GTLRService
// No new methods
// Clients should create a standard query with any of the class methods in
// GTLRCloudTraceQuery.h. The query can the be sent with GTLRService's execute
// methods,
//
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// completionHandler:(void (^)(GTLRServiceTicket *ticket,
// id object, NSError *error))handler;
// or
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// delegate:(id)delegate
// didFinishSelector:(SEL)finishedSelector;
//
// where finishedSelector has a signature of:
//
// - (void)serviceTicket:(GTLRServiceTicket *)ticket
// finishedWithObject:(id)object
// error:(NSError *)error;
//
// The object passed to the completion handler or delegate method
// is a subclass of GTLRObject, determined by the query method executed.
@end
NS_ASSUME_NONNULL_END
#pragma clang diagnostic pop
|
#ifndef OPENSIM_MOCOINITIALFORCEEQUILIBRIUMDGFGOAL_H
#define OPENSIM_MOCOINITIALFORCEEQUILIBRIUMDGFGOAL_H
/* -------------------------------------------------------------------------- *
* OpenSim: MocoInitialForceEquilibriumDGFGoal.h *
* -------------------------------------------------------------------------- *
* Copyright (c) 2020 Stanford University and the Authors *
* *
* Author(s): Nicholas Bianco *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may *
* not use this file except in compliance with the License. You may obtain a *
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* -------------------------------------------------------------------------- */
#include "MocoGoal.h"
namespace OpenSim {
class DeGrooteFregly2016Muscle;
/** For all DeGrooteFregly2016Muscle%s with explicit tendon compliance dynamics,
constrain (or minimize) the error computed from the muscle-tendon force
equilibrium equation.
This goal ensures that the initial normalized tendon force state variable
is chosen such that equilibrium is satisfied; otherwise, the initial state
may not be valid.
This is an endpoint constraint goal by default.
@note This goal only applies to DeGrooteFregly2016Muscle%s since it relies on
the method calcEquilibriumResidual() provided by that class. Calls to
calcEquilibriumResidual() set the normalized tendon force derivative
argument to zero.
@ingroup mocogoal */
class OSIMMOCO_API MocoInitialForceEquilibriumDGFGoal : public MocoGoal {
OpenSim_DECLARE_CONCRETE_OBJECT(
MocoInitialForceEquilibriumDGFGoal, MocoGoal);
public:
MocoInitialForceEquilibriumDGFGoal() = default;
MocoInitialForceEquilibriumDGFGoal(std::string name)
: MocoGoal(std::move(name)) {}
protected:
bool getSupportsEndpointConstraintImpl() const override { return true; }
Mode getDefaultModeImpl() const override {
return Mode::EndpointConstraint;
}
void initializeOnModelImpl(const Model&) const override;
void calcGoalImpl(
const GoalInput& input, SimTK::Vector& goal) const override;
private:
mutable std::vector<SimTK::ReferencePtr<const DeGrooteFregly2016Muscle>>
m_muscleRefs;
};
} // namespace OpenSim
#endif // OPENSIM_MOCOINITIALFORCEEQUILIBRIUMDGFGOAL_H
|
#include "mpi.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char *argv[])
{
//////////////
//////////////
double A[320][320]; //матрица зависимости температур
double vB[320]; //вектор свободных коэффициентов
double vR[320]; //разрешающий столбец
double vX[320]; // столбец ответов
//double bvX[320]; // столбец ответов
double locA[320][320]; //локальные подматрицы
//double locB[320];
double buffSend[320]; //буфер отправки
double buffRecv[320]; //буфер приёма
//double buffRB[1];
char buffRecv1[]="no ";
//int tabS0[320];//даблица соответствия индексов столбцов
//int tabS1[320];//даблица соответствия индексов столбцов
int myid, numprocs;
double startwtime, endwtime;
//////////////
//////////////
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
if(myid==0)
startwtime = MPI_Wtime();
int N = -1; //размерность матрицы
MPI_Status status;
if(myid==0)
{
//открытие файлов
char s[12];
FILE *fA,*fB,*fN;
fN=fopen("N.txt","rb");
fgets(s,10,fN);
fclose(fN);
N=atoi(s); //получени размерности матриц
fA=fopen("mT.txt","rb");
int i,j;
for(i=0;i<N;i++)
{for(j=0;j<N;j++)
{
fgets(s,11,fA);
A[i][j]=atof(s);
//printf("- %f\n",A[i][j]);
}
}
fclose(fA);
fB=fopen("vB.txt","rb");
for(i=0;i<N;i++)
{
fgets(s,11,fB);
vB[i]=atof(s);
//printf("- %f\n",vB[i]);
}
fclose(fB);
sprintf(buffRecv1," %d ",N);
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast(buffRecv1, 10, MPI_CHAR, 0, MPI_COMM_WORLD);
N=atoi(buffRecv1);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast(vB,N,MPI_DOUBLE,0,MPI_COMM_WORLD);
//вычисление порядка лок матриц
int locN=0;
int i;
for(i=myid;i<N;i+=numprocs)
locN++;
//printf("Go to %d!!",locN);
if(myid==0)
{
int i;
int j=0;
int p=0;
int k=0;
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
buffSend[j]=A[i][j];
//buffRB[0]=vB[i];
if(p==numprocs)
p=0;
if(p==0)
{
for(j=0;j<N;j++)
{
locA[k][j]=buffSend[j];
}
//locB[k]=buffRB[0];
k++;
}
else
{
MPI_Send(buffSend,N,MPI_DOUBLE,p,99,MPI_COMM_WORLD);
//MPI_Send(buffRB,1,MPI_DOUBLE,p,99,MPI_COMM_WORLD);
}
p++;
}
}
int j=0;
if(myid!=0)
{
for(i=0;i<locN;i++)
{
MPI_Recv(buffRecv, N, MPI_DOUBLE,0,99,MPI_COMM_WORLD,&status);
//MPI_Recv(buffRB,1,MPI_DOUBLE,0,99,MPI_COMM_WORLD,&status);
for(j=0;j<N;j++)
{
locA[i][j]=buffRecv[j];
}
//locB[i]=buffRB[0];
//printf(" %d -- b[%d]= %f\n",myid, i,locB[i]);
}
}
for(i=0;i<N;i++) //обнуленив вектора R
vR[i]=0;
//самопланирующияся алгоритм умножения матриц
MPI_Barrier(MPI_COMM_WORLD);
for(i=0;i<locN;i++)
for(j=0;j<N;j++)
vR[i]+=locA[i][j]*vB[j];
if(myid==0)
{
int nloki[320];
for(i=0;i<numprocs;i++)
nloki[i]=0;
j=0;
for(i=0;i<N;i++)
{
if(j==numprocs)
j=0;
nloki[j]++;
j++;
}
for(i=1;i<numprocs;i++)
{
MPI_Recv(buffRecv, nloki[i], MPI_DOUBLE,i,99,MPI_COMM_WORLD,&status);
for(j=0;j<nloki[i];j++)
{
vX[i+j*numprocs]=buffRecv[j];
}
}
for(i=0,j=0;i<N;i++,j+=numprocs)
{
vX[j]=vR[i];
}
}
else
{
MPI_Send(vR,locN,MPI_DOUBLE,0,99,MPI_COMM_WORLD);
}
if(myid==0)
{
for(i=0;i<N;i++)
printf(" %d -- R[%d]= %f\n",myid, i,vX[i]);
}
/*for(i=0;i<locN;i++)
printf(" %d -- R[%d]= %f\n",myid, i,vR[i]);*/
//умножение не распределённое
/*if(myid==0)
{
for(i=0;i<N;i++)
for(j=0;j<N;j++)
vR[i]+=A[i][j]*vB[j];
for(i=0;i<N;i++)
printf("%f\n",vR[i]);
}*/
//конец умножения нераспределённого
if(myid==0)
endwtime = MPI_Wtime();
/*///////////////////////////////
// вывод ответов в файл //
///////////////////////////////
if(myid==0)
{
FILE *fil;
fil=fopen("vekX.txt","wb");
for(i=0;i<N;i++)
fprintf(fil,"%f\n",vX[i]);
fclose(fil);
}*/
if(myid==0)
printf("Reshenie SLAU zaverhen\n wall clock time = %f\n",endwtime-startwtime);
MPI_Finalize();
return 0;
}
|
//
// UIImage+LPYImage.h
// 01-彩票
//
// Created by 刘蒲艳 on 15/6/27.
// Copyright (c) 2015年 liupuyan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (SCPExtension)
/**
* 图片显示原来的内容,不被渲染
*
* @return <#return value description#>
*/
+ (instancetype)imageRenderingModeAlwaysOriginalNamed:(NSString *)name;
/**
* 图片中间部分拉伸
*
* @param name <#name description#>
*
* @return <#return value description#>
*/
+ (instancetype)imageStretchableWithNamed:(NSString *)name;
/**
* 图片样式
*
* @param image <#image description#>
*
* @return <#return value description#>
*/
- (instancetype)imageStyle;
@end
|
//
// Datum - animation
//
//
// Copyright (c) 2017 Peter Niekamp
//
#pragma once
#include "resource.h"
#include "mesh.h"
//|---------------------- Pose ----------------------------------------------
//|--------------------------------------------------------------------------
class Pose
{
public:
Pose();
Pose(int bonecount, StackAllocator<> const &allocator);
Pose(int bonecount, StackAllocatorWithFreelist<> const &allocator);
Pose(Pose const &) = delete;
Pose(Pose &&that) noexcept;
Pose &operator =(Pose &&that) noexcept;
~Pose();
friend void swap(Pose &a, Pose &b);
public:
int bonecount;
lml::Transform *bones;
private:
FreeList *m_freelist;
};
//|---------------------- Animation -----------------------------------------
//|--------------------------------------------------------------------------
class Animation
{
public:
struct Joint
{
char name[32];
uint32_t parent;
uint32_t index;
uint32_t count;
};
struct Transform
{
float time;
lml::Transform transform;
};
public:
friend Animation const *ResourceManager::create<Animation>(Asset const *asset);
bool ready() const { return (state == State::Ready); }
float duration;
int jointcount;
int transformcount;
Joint const *joints;
Transform const *transforms;
public:
enum class State
{
Empty,
Loading,
Ready,
};
Asset const *asset;
std::atomic<State> state;
protected:
Animation() = default;
};
//|---------------------- Animator ------------------------------------------
//|--------------------------------------------------------------------------
class Animator
{
public:
using allocator_type = StackAllocatorWithFreelist<>;
Animator(allocator_type const &allocator);
public:
Pose pose;
void set_mesh(Mesh const *mesh);
void play(Animation const *animation, lml::Vec3 const &scale = lml::Vec3(1.0f), float rate = 1.0f, bool looping = true);
void set_time(size_t channel, float time);
void set_rate(size_t channel, float rate);
void set_weight(size_t channel, float weight, float maxdelta = 1.0f);
bool prepare();
void update(float dt);
private:
allocator_type m_allocator;
private:
Mesh const *m_mesh;
private:
struct Joint
{
char name[32];
lml::Transform transform;
int parent;
int bone;
};
std::vector<Joint, StackAllocatorWithFreelist<Joint>> m_joints;
std::vector<size_t, StackAllocatorWithFreelist<size_t>> m_jointmap;
struct Channel
{
Animation const *animation;
lml::Vec3 scale;
float time;
float rate;
float weight;
bool looping;
int jointmapbase;
int jointmapcount;
};
std::vector<Channel, StackAllocatorWithFreelist<Channel>> m_channels;
};
|
/**
Copyright 2017 Otavio Rodolfo Piske
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "vmslh.h"
static void vmslh_callback_cleanup(void **ptr) {
vmslh_callback_t *cb = *ptr;
if (!cb) {
return;
}
gru_dealloc((void **) &cb);
}
static vmslh_callback_t * vmslh_by_addr(gru_list_t *list, vmslh_callback_fn callback, gru_status_t *status) {
gru_node_t *node = list->root;
while (node) {
vmslh_callback_t *vmslh_callback = (vmslh_callback_t *) node->data;
if (vmslh_callback && vmslh_callback->call == callback) {
return vmslh_callback;
}
node = node->next;
}
vmslh_callback_t *ret = gru_alloc(sizeof(vmslh_callback_t), status);
if (!gru_list_append(list, ret)) {
gru_dealloc((void **)&ret);
gru_status_set(status, GRU_FAILURE, "Unable to append VMSL handler wrapper");
return NULL;
}
return ret;
}
bool vmslh_add(gru_list_t *list, vmslh_callback_fn callback, void *payload, gru_status_t *status) {
vmslh_callback_t *wrapper = vmslh_by_addr(list, callback, status);
if (!wrapper) {
return false;
}
wrapper->call = callback;
wrapper->payload = payload;
return true;
}
void vmslh_run(gru_list_t *list, void *ctxt, void *msg) {
if (!list) {
return;
}
gru_node_t *node = list->root;
while (node) {
vmslh_callback_t *callback = (vmslh_callback_t *) node->data;
callback->call(ctxt, msg, callback->payload);
node = node->next;
}
}
vmslh_handlers_t vmslh_new(gru_status_t *status) {
vmslh_handlers_t handlers = {0};
handlers.before_connect = gru_list_new(status);
handlers.after_connect = gru_list_new(status);
handlers.before_send = gru_list_new(status);
handlers.after_send = gru_list_new(status);
handlers.before_receive = gru_list_new(status);
handlers.after_receive = gru_list_new(status);
handlers.finalize_receive = gru_list_new(status);
return handlers;
}
void vmslh_cleanup(vmslh_handlers_t *handlers) {
if (!handlers) {
return;
}
gru_list_clean(handlers->before_connect, vmslh_callback_cleanup);
gru_list_clean(handlers->after_connect, vmslh_callback_cleanup);
gru_list_clean(handlers->before_send, vmslh_callback_cleanup);
gru_list_clean(handlers->after_send, vmslh_callback_cleanup);
gru_list_clean(handlers->before_receive, vmslh_callback_cleanup);
gru_list_clean(handlers->after_receive, vmslh_callback_cleanup);
gru_list_clean(handlers->finalize_receive, vmslh_callback_cleanup);
gru_list_destroy(&handlers->before_connect);
gru_list_destroy(&handlers->after_connect);
gru_list_destroy(&handlers->before_send);
gru_list_destroy(&handlers->after_send);
gru_list_destroy(&handlers->before_receive);
gru_list_destroy(&handlers->after_receive);
gru_list_destroy(&handlers->finalize_receive);
} |
#include "foundation/math/imath.h"
SP_SUIT(imath);
SP_CASE(imath, xx) {
ireal i = iSQR(1);
ireal izero = iSQR(0);
SP_TRUE(i==1);
SP_TRUE(izero==0);
ireal ix = iSQR(1.414);
SP_TRUE(ireal_equal_in(2, ix, 0.001));
}
SP_CASE(imath, idegreestoradians) {
ireal pi = idegreestoradians(180);
SP_TRUE(ireal_equal(pi, __iPI));
}
SP_CASE(imath, irandianstodegrees) {
ireal degree = irandianstodegrees(__iPI);
SP_TRUE(ireal_equal(degree, 180));
}
SP_CASE(imath, iclamp) {
ireal x0 = iclamp(0, 0, 1);
SP_TRUE(ireal_equal(x0, 0));
ireal x1 = iclamp(1, 0, 1);
SP_TRUE(ireal_equal(x1, 1));
ireal xx = iclamp(0.5, 0, 1);
SP_TRUE(ireal_equal(xx, 0.5));
ireal xx0 = iclamp(-1, 0, 1);
SP_TRUE(ireal_equal(xx0, 0));
ireal xx1 = iclamp(2, 0, 1);
SP_TRUE(ireal_equal(xx1, 1));
}
SP_CASE(imath, ilerp) {
// v = x + (y-x) * t
ireal v = ilerp(0, 1, 0);
SP_TRUE(ireal_equal(v, 0));
v = ilerp(0, 1, 1);
SP_TRUE(ireal_equal(v, 1));
v = ilerp(0, 1, 0.5);
SP_TRUE(ireal_equal(v, 0.5));
v = ilerp(0, 1, 2);
SP_TRUE(ireal_equal(v, 2));
v = ilerp(0, 1, -0.5);
SP_TRUE(ireal_equal(v, -0.5));
}
SP_CASE(imath, end) {
SP_TRUE(1);
imemoryglobalclear();
SP_EQUAL(imemoryglobaluse(), _g_memory_in_use);
}
|
//===- AArch64CallLowering.h - Call lowering --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file describes how to lower LLVM calls to machine code calls.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
#define LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
#include "llvm/IR/CallingConv.h"
#include <cstdint>
#include <functional>
namespace llvm {
class AArch64TargetLowering;
class CCValAssign;
class DataLayout;
class MachineIRBuilder;
class MachineRegisterInfo;
class Type;
class AArch64CallLowering: public CallLowering {
public:
AArch64CallLowering(const AArch64TargetLowering &TLI);
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
ArrayRef<unsigned> VRegs,
unsigned SwiftErrorVReg) const override;
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
ArrayRef<unsigned> VRegs) const override;
bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv,
const MachineOperand &Callee, const ArgInfo &OrigRet,
ArrayRef<ArgInfo> OrigArgs,
unsigned SwiftErrorVReg) const override;
bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv,
const MachineOperand &Callee, const ArgInfo &OrigRet,
ArrayRef<ArgInfo> OrigArgs) const override {
return lowerCall(MIRBuilder, CallConv, Callee, OrigRet, OrigArgs, 0);
}
bool supportSwiftError() const override { return true; }
private:
using RegHandler = std::function<void(MachineIRBuilder &, Type *, unsigned,
CCValAssign &)>;
using MemHandler =
std::function<void(MachineIRBuilder &, int, CCValAssign &)>;
using SplitArgTy = std::function<void(unsigned, uint64_t)>;
void splitToValueTypes(const ArgInfo &OrigArgInfo,
SmallVectorImpl<ArgInfo> &SplitArgs,
const DataLayout &DL, MachineRegisterInfo &MRI,
CallingConv::ID CallConv,
const SplitArgTy &SplitArg) const;
};
} // end namespace llvm
#endif // LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/util/arrayref.h>
#include "doc_vector_access.h"
#include "nns-l2.h"
#include <memory>
struct SqDist {
double distance;
explicit SqDist(double d) noexcept : distance(d) {}
};
struct NnsHit {
uint32_t docid;
SqDist sq;
NnsHit(uint32_t di, SqDist sqD) noexcept
: docid(di), sq(sqD) {}
};
struct NnsHitComparatorLessDistance {
bool operator() (const NnsHit &lhs, const NnsHit& rhs) const {
if (lhs.sq.distance > rhs.sq.distance) return false;
if (lhs.sq.distance < rhs.sq.distance) return true;
return (lhs.docid > rhs.docid);
}
};
struct NnsHitComparatorGreaterDistance {
bool operator() (const NnsHit &lhs, const NnsHit& rhs) const {
if (lhs.sq.distance < rhs.sq.distance) return false;
if (lhs.sq.distance > rhs.sq.distance) return true;
return (lhs.docid > rhs.docid);
}
};
struct NnsHitComparatorLessDocid {
bool operator() (const NnsHit &lhs, const NnsHit& rhs) const {
return (lhs.docid < rhs.docid);
}
};
class BitVector {
private:
std::vector<uint64_t> _bits;
public:
BitVector(size_t sz) : _bits((sz+63)/64) {}
BitVector& setBit(size_t idx) {
uint64_t mask = 1;
mask <<= (idx%64);
_bits[idx/64] |= mask;
return *this;
}
bool isSet(size_t idx) const {
uint64_t mask = 1;
mask <<= (idx%64);
uint64_t word = _bits[idx/64];
return (word & mask) != 0;
}
BitVector& clearBit(size_t idx) {
uint64_t mask = 1;
mask <<= (idx%64);
_bits[idx/64] &= ~mask;
return *this;
}
};
template <typename FltType = float>
class NNS
{
public:
NNS(uint32_t numDims, const DocVectorAccess<FltType> &dva)
: _numDims(numDims), _dva(dva)
{}
virtual void addDoc(uint32_t docid) = 0;
virtual void removeDoc(uint32_t docid) = 0;
using Vector = vespalib::ConstArrayRef<FltType>;
virtual std::vector<NnsHit> topK(uint32_t k, Vector vector, uint32_t search_k) = 0;
virtual std::vector<NnsHit> topKfilter(uint32_t k, Vector vector, uint32_t search_k, const BitVector &skipDocIds) = 0;
virtual ~NNS() {}
protected:
uint32_t _numDims;
const DocVectorAccess<FltType> &_dva;
};
extern
std::unique_ptr<NNS<float>>
make_annoy_nns(uint32_t numDims, const DocVectorAccess<float> &dva);
extern
std::unique_ptr<NNS<float>>
make_rplsh_nns(uint32_t numDims, const DocVectorAccess<float> &dva);
extern
std::unique_ptr<NNS<float>>
make_hnsw_nns(uint32_t numDims, const DocVectorAccess<float> &dva);
extern
std::unique_ptr<NNS<float>>
make_hnsw_wrap(uint32_t numDims, const DocVectorAccess<float> &dva);
|
#ifndef H_STR2AV
#define H_STR2AV
typedef enum {
STR2AV_OK = 0,
STR2AV_UNBALANCED_QUOTE
} str_to_argv_err_t;
#ifdef __cplusplus
extern "C"
#endif
str_to_argv_err_t str2av(char const * str, int * argc_p, char *** argv_p);
#endif
|
//
// Created by Paint on 2017/7/3.
//
#ifndef KTVDEMO_AUDIOPROCESSINGPROXY_H
#define KTVDEMO_AUDIOPROCESSINGPROXY_H
#include <webrtc/modules/audio_processing/audio_processing_impl.h>
#include <webrtc/modules/audio_processing/include/audio_processing.h>
#include <webrtc/modules/include/module_common_types.h>
#include <webrtc/common_audio/resampler/push_sinc_resampler.h>
#include <stdlib.h>
using namespace webrtc;
// Audio processing
const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate;
const bool kDefaultNsState =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
false;
#else
true;
#endif
const GainControl::Mode kDefaultAgcMode =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
GainControl::kAdaptiveDigital;
#else
GainControl::kAdaptiveAnalog;
#endif
const bool kDefaultAgcState =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
false;
#else
true;
#endif
// VolumeControl
enum { kMinVolumeLevel = 0 };
enum { kMaxVolumeLevel = 255 };
class AudioProcessingProxy{
public:
const int k10ms_ratio = 100; //10ms数据和采样率的转换因子
AudioProcessingProxy();
~AudioProcessingProxy();
int setAgcState(bool enable);
int setAgcMode(GainControl::Mode mode);
int setNsState(bool enable);
int setNsLevel(NoiseSuppression::Level level);
/**
*
* @param input intput and output address can be the same
* @param output
* @param numberOfSamples
* @param samplerate
* @param num_channels 2 for stereo, 1 for mono
* @param speech_type
* @param vad_activity
* @param energy
* @return
*/
int process(short int *input, short int *output, int numberOfSamples, int samplerate,
size_t num_channels = 1, AudioFrame::SpeechType speech_type = AudioFrame::kNormalSpeech,
AudioFrame::VADActivity vad_activity = AudioFrame::kVadUnknown, uint32_t energy = -1);
private:
AudioProcessing* apm;
AudioFrame* audioFrame;
short int * inputBuffer;
short int * outputBuffer;
size_t inputNumFrames;
size_t procNumFrames;
PushSincResampler* inputResampler;
PushSincResampler* outputResampler;
int calCurProcNumFrame(int input_num_frames);
};
#endif //KTVDEMO_AUDIOPROCESSINGPROXY_H
|
/***************************************************************
*
* Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
***************************************************************/
#ifndef DAGMAN_SUBMIT_H
#define DAGMAN_SUBMIT_H
#include "condor_id.h"
/** Submits a job to condor using popen(). This is a very primitive method
to submitting a job, and SHOULD be replacable by a HTCondor Submit API.
In the mean time, this function executes the condor_submit command
via popen() and parses the output, sniffing for the CondorID assigned
to the submitted job.
Parsing the condor_submit output successfully depends on the current
version of HTCondor, and how it's condor_submit outputs results on the
command line.
@param dm the appropriate Dagman object
@param cmdFile the job's HTCondor command file.
@param condorID will hold the ID for the submitted job (if successful)
@param DAGNodeName the name of the job's DAG node
@param DAGParentNodeNames a delimited string listing the node's parents
@param vars list of any variables for this node
@param priority the priority of this node
@param retry the retry number (0 the first time the job is run)
@param directory the directory in which to run this job
@param default log file name
@param whether to use the default log
@param log file to force this job to use (should be null if submit
file specifies log file)
@param hold_claim is true if DAGMAN_HOLD_CLAIM_IDLE is positive
@return true on success, false on failure
*/
bool condor_submit( const Dagman &dm, const char* cmdFile, CondorID& condorID,
const char* DAGNodeName, const char *DAGParentNodeNames,
Job* node, int priority, int retry,
const char* directory, const char *worflowLogFile,
bool hold_claim, const std::string &batchName,
std::string &batchId );
bool direct_condor_submit(const Dagman &dm, Job* node,
const char *worflowLogFile,
const std::string &parents,
const char *batchName,
const char *batchId,
CondorID& condorID);
bool send_reschedule(const Dagman &dm);
void set_fake_condorID( int subprocID );
bool fake_condor_submit( CondorID& condorID, Job* job, const char* DAGNodeName,
const char* directory, const char *logFile );
int get_fake_condorID();
bool writePreSkipEvent( CondorID& condorID, Job* job, const char* DAGNodeName,
const char* directory, const char *logFile );
#endif /* #ifndef DAGMAN_SUBMIT_H */
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2010 by TinyToDo, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#include "TiBase.h"
#ifdef USE_TI_MAP
#import <MapKit/MapKit.h>
@class TiMapRouteViewInternal;
@interface TiMapRouteAnnotationView : MKAnnotationView {
@private
MKMapView* mapView;
TiMapRouteViewInternal* internalRouteView;
}
@property (nonatomic, retain) MKMapView* mapView;
// signal from our view controller that the map region changed. We will need to resize, recenter and
// redraw the contents of this view when this happens.
-(void) regionChanged;
@end
#endif |
/****************************************************************************
*
* Copyright 2017 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/
/****************************************************************************
*
* Copyright © 2005-2014 Rich Felker, et al.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
***************************************************************************/
/************************************************************************
* Included Files
************************************************************************/
#include <math.h>
#include <float.h>
#ifdef CONFIG_HAVE_LONG_DOUBLE
/************************************************************************
* Public Functions
************************************************************************/
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fminl(long double x, long double y)
{
return fmin(x, y);
}
#else
long double fminl(long double x, long double y)
{
if (isnan(x)) {
return y;
}
if (isnan(y)) {
return x;
}
/* handle signed zeros, see C99 Annex F.9.9.2 */
if (signbit(x) != signbit(y)) {
return signbit(x) ? x : y;
}
return x < y ? x : y;
}
#endif
#endif
|
#include "include.h"
#define MAX_STAT 10000
#define FLAT_CONST 298.256
#define ERAD 6378.139
#define RPERD 0.017453292
#define FONE (float)(1.0)
#define FTWO (float)(2.0)
void *check_malloc(int);
FILE *fopfile(char*, char*);
#include "function.h"
main(int ac,char **av)
{
FILE *fopfile(), *fpr, *fpw;
float mlat, mlon, xazim, mrot;
float kperd_n, kperd_e, ar1, ar2, ar3, ar4;
float xp, yp, zp, plon, plat;
float cosR, sinR;
int nr;
float xlen = 100.0;
float ylen = 100.0;
char infile[512], outfile[512], str[512];
char name[16];
float rperd = RPERD;
float erad = ERAD;
float fc = FLAT_CONST;
float g2, radc, latavg;
double g0, b0;
double amat[9], ainv[9];
int xy2ll = 0;
int ll2xy = 1;
double xr0, yr0, dlon, dlat, dxr, dyr;
int geo2utm = 0;
int utm2geo = 1;
int utm_zone = 11;
/*
geoproj=0: RWG spherical projection with local kmplat, kmplon
=1: RWG great circle projection
=2: UTM coordinate projection
*/
int geoproj = 1; /* default is great-circle way */
int center_origin = 0;
float xshift = -1.0e+15;
float yshift = -1.0e+15;
sprintf(outfile,"stdout");
sprintf(infile,"stdin");
setpar(ac, av);
mstpar("mlat","f",&mlat);
mstpar("mlon","f",&mlon);
mstpar("xazim","f",&xazim);
getpar("xlen","f",&xlen);
getpar("ylen","f",&ylen);
getpar("infile","s",infile);
getpar("outfile","s",outfile);
getpar("geoproj","d",&geoproj);
getpar("center_origin","d",¢er_origin);
getpar("xshift","f",&xshift);
getpar("yshift","f",&yshift);
endpar();
mrot = xazim - 90.0;
cosR = cos(mrot*rperd);
sinR = sin(mrot*rperd);
if(center_origin != 0)
{
xshift = -0.5*xlen;
yshift = -0.5*ylen;
}
else
{
if(xshift < -1.0e+14)
xshift = 0.0;
if(yshift < -1.0e+14)
yshift = 0.0;
}
if(geoproj == 0)
{
radc = ERAD*RPERD;
set_g2(&g2,&fc);
latavg = mlat;
if(center_origin == 0) /* backward compatible */
latavg = mlat - 0.5*(xlen*sinR + ylen*cosR)/111.20;
geocen(&latavg,(double)(latavg*rperd));
latlon2km(&latavg,&kperd_n,&kperd_e,&radc,&g2);
ar1 = cosR/kperd_e;
ar2 = sinR/kperd_e;
ar3 = cosR/kperd_n;
ar4 = sinR/kperd_n;
}
else if(geoproj == 1)
{
gen_matrices(amat,ainv,&mrot,&mlon,&mlat);
g0 = (double)(0.5*ylen)/(double)(erad);
b0 = (double)(0.5*xlen)/(double)(erad);
g0 = 0.0;
b0 = 0.0;
}
else if(geoproj == 2)
{
dlon = mlon;
dlat = mlat;
geoutm_(&dlon,&dlat,&xr0,&yr0,&utm_zone,&geo2utm);
}
name[0] = '\0';
if(strcmp(outfile,"stdout") == 0)
fpw = stdout;
else
fpw = fopfile(outfile,"w");
if(strcmp(infile,"stdin") == 0)
fpr = stdin;
else
fpr = fopfile(infile,"r");
while(fgets(str,512,fpr) != NULL)
{
nr = sscanf(str,"%f %f %f %s",&xp,&yp,&zp,name);
if(geoproj == 0)
{
plon = mlon + (xp+xshift)*ar1 - (yp+yshift)*ar2;
plat = mlat - (xp+xshift)*ar4 - (yp+yshift)*ar3;
}
else if(geoproj == 1)
{
gcproj(&xp,&yp,&plon,&plat,&erad,&g0,&b0,amat,ainv,xy2ll);
}
else if(geoproj == 2)
{
dxr = xr0 + 1000.0*((xp+xshift)*ar1 - (yp+yshift)*ar2);
dyr = yr0 - 1000.0*((xp+xshift)*ar4 + (yp+yshift)*ar3);
geoutm_(&dlon,&dlat,&dxr,&dyr,&utm_zone,&utm2geo);
plon = dlon;
plat = dlat;
}
if(nr == 4)
fprintf(fpw,"%11.5f %11.5f %11.5f %s\n",plon,plat,zp,name);
if(nr == 3)
fprintf(fpw,"%11.5f %11.5f %11.5f\n",plon,plat,zp);
}
fclose(fpr);
fclose(fpw);
}
double geocenX(x)
double x;
{
double r;
r = atan((1.0 - (1.0/FLAT_CONST))*tan(x));
return(r);
}
set_g2X(g2,fc)
float *g2, *fc;
{
float f;
f = (1.0)/(*fc);
*g2 = ((2.0)*f - f*f)/(((1.0) - f)*((1.0) - f));
}
latlon2kmX(arg,latkm,lonkm,rc,g2)
float *arg, *latkm, *lonkm, *rc, *g2;
{
float cosA, sinA, g2s2, den;
cosA = cos((*arg));
sinA = sin((*arg));
g2s2 = (*g2)*sinA*sinA;
den = sqrt((FONE)/((FONE) + g2s2));
*lonkm = (*rc)*cosA*den;
*latkm = (*rc)*(sqrt((FONE) + g2s2*((FTWO) + (*g2))))*den*den*den;
}
FILE *fopfile(char *name,char *mode)
{
FILE *fp;
if((fp = fopen(name,mode)) == NULL)
{
fprintf(stderr,"CAN'T FOPEN FILE = %s, MODE = %s\n", name, mode);
exit(-1);
}
return(fp);
}
void *check_malloc(int len)
{
char *ptr;
ptr = (char *) malloc (len);
if(ptr == NULL)
{
fprintf(stderr,"***** memory allocation error\n");
exit(-1);
}
return(ptr);
}
|
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0"
*
* Written by Nir Drucker, Shay Gueron, and Dusan Kostic,
* AWS Cryptographic Algorithms Group.
* (ndrucker@amazon.com, gueron@amazon.com, dkostic@amazon.com)
*/
#pragma once
#include "cleanup.h"
#include <openssl/evp.h>
#define MAX_AES_INVOKATION (MASK(32))
#define AES256_KEY_SIZE (32U)
#define AES256_KEY_BITS (AES256_KEY_SIZE * 8)
#define AES256_BLOCK_SIZE (16U)
#define AES256_ROUNDS (14U)
typedef ALIGN(16) struct aes256_key_s
{
uint8_t raw[AES256_KEY_SIZE];
} aes256_key_t;
_INLINE_ void
aes256_key_cleanup(aes256_key_t *o)
{
secure_clean(o->raw, sizeof(*o));
}
// Using OpenSSL structures
typedef EVP_CIPHER_CTX *aes256_ks_t;
_INLINE_ ret_t
aes256_key_expansion(OUT aes256_ks_t *ks, IN const aes256_key_t *key)
{
*ks = EVP_CIPHER_CTX_new();
if(*ks == NULL)
{
BIKE_ERROR(EXTERNAL_LIB_ERROR_OPENSSL);
}
if(0 == EVP_EncryptInit_ex(*ks, EVP_aes_256_ecb(), NULL, key->raw, NULL))
{
EVP_CIPHER_CTX_free(*ks);
BIKE_ERROR(EXTERNAL_LIB_ERROR_OPENSSL);
}
EVP_CIPHER_CTX_set_padding(*ks, 0);
return SUCCESS;
}
_INLINE_ ret_t
aes256_enc(OUT uint8_t *ct, IN const uint8_t *pt, IN const aes256_ks_t *ks)
{
int outlen = 0;
if(0 == EVP_EncryptUpdate(*ks, ct, &outlen, pt, AES256_BLOCK_SIZE))
{
BIKE_ERROR(EXTERNAL_LIB_ERROR_OPENSSL);
}
return SUCCESS;
}
_INLINE_ void
aes256_free_ks(OUT aes256_ks_t *ks)
{
EVP_CIPHER_CTX_free(*ks);
ks = NULL;
}
|
#ifndef TRACKLISTHANDLER_H
#define TRACKLISTHANDLER_H
#include <stdint.h>
#include <QStringList>
#include "avobject.h"
class TrackListHandler {
public:
TrackListHandler();
void add(QString &);
void add(QStringList &);
void remove(int32_t);
void remove(QList<int32_t> &);
void setPath(int32_t, QString &);
QString getPath(int32_t) const;
bool hasPath(int32_t);
bool exists(int32_t);
void play(int32_t);
void stop(int32_t);
bool isPlaying(int32_t);
void clear();
void print() const;
private:
QList<AVObject> trackList;
};
#endif
|
//
// MFAddViewController.h
// BoLianEducation
//
// Created by BoLian on 2017/5/3.
// Copyright © 2017年 BoLian. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MFAddViewController : UIViewController
@end
|
enum Maybe : bool { No, Yes };
enum BinaryNumbers : bool { One = 1, Zero = 0 };
enum class EnumClass : bool { Foo, Bar };
struct WrapperStruct {
enum InnerBoolEnum : bool { A, B };
};
|
//
// AppDelegate.h
// FXAudioSDKDemo
//
// Created by wyman on 2017/7/26.
// Copyright © 2017年 wyman. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*************************************************************************
> File Name: SIPDSClient.h
> Author: cooperz
> Mail: zbzcsn@qq.com
> Created Time: Thu 23 Jul 2015 02:37:18 PM CST
************************************************************************/
#ifndef _SIPCLIENT_H
#define _SIPCLIENT_H
#include <iostream>
#include "SIPUABase.h"
#include "SIPStatuCode.h"
namespace svss
{
namespace SIP
{
enum DS_CLIENT_FSM
{
DS_CLIENT_FSM_START,
DS_CLIENT_FSM_INVITE_STORE,
DS_CLIENT_FSM_REGISTER,
DS_CLIENT_FSM_HEARTBEAT,
DS_CLIENT_FSM_END
};
struct DSClientState
{
DS_CLIENT_FSM fsm_state;
uint32_t sip_tid;
};
class SIPDSClient : public SIPUABase
{
public:
explicit SIPDSClient( std::string local_dev_name,
std::string local_ip,
std::string local_port,
std::string passwd
);
virtual ~SIPDSClient();
/*
* fuction: FSMDrive
* input:
* msg:收到的sip协议信息
* len:收到的suo协议信息长度
* output:
* rt_task_id:返回该sip协议对应的上层任务id
* rtmsg:需要发送的sip消息体
* rtlen:需要发送的sip消息体长度
* return:
* SIP_SUCCESS:心跳或者注册成功时返回
* SIP_CONTINUE: 证明任务正常进行,需要把remsg发送出去
* SIP_INVITE_STROE_ACK: 证明发出的邀请某个摄像头数据的
* 请求成功了
* */
SIP_STATE_CODE FSMDrive( char* msg, size_t len,
uint32_t* rt_task_id, char** rtmsg,
size_t* rtlen);
int ClientInit();
/*
* fuction: RegisterDSClient
* input :
* task_id: 你发起注册任务的任务id
* remote_name: sip 服务器的dev名字
* remote_ip:sip服务器的ip
* remote_port: sip服务器的端口
* output :
* rtmsg:需要发送的sip消息体
* len: rtmsg的大小
* return:
* SIP_CONTINUE:表示构造sip消息成功
* 其他返回值就是错误
* */
SIP_STATE_CODE RegisterDSClient( uint32_t task_id, char** rtmsg,
size_t *len,
std::string remote_name,
std::string remote_ip,
std::string remote_port);
SIP_STATE_CODE UnRegisterClient();
/*
* fuction: InviteStore
* input :
* task_id: 你发起邀请摄像头任务的任务id
* recv_port:要求摄像头发数据发向本机的哪个端口
* dev_id_been_invited: 摄像头的dev_name
* output :
* rtmsg:需要发送的sip消息体
* rtlen: rtmsg的大小
* return :
* SIP_CONTINUE:表示构造sip消息成功
* SIP_
* 其他返回值就是错误
* */
SIP_STATE_CODE InviteStore( uint32_t task_id, std::string recv_port,
std::string dev_id_been_invited,
char** rtmsg, size_t *rtlen);
/*
* fuction: HeartBeat
* input :
* task_id: 你发起心跳任务的任务id
* output :
* rtmsg:需要发送的sip消息体
* rtlen:rtmsg的大小
* return :
* SIP_CONTINUE:表示构造sip消息成功
* 其他返回值就是错误
* */
SIP_STATE_CODE HeartBeat( uint32_t task_id, char** rtmsg,
size_t *rtlen);
private:
DS_CLIENT_FSM _fsm_status_;
std::map< uint32_t, struct DSClientState> _task_state_machine_;
std::map< uint32_t, uint32_t> _siptid_taskid_;
int _recver_vedio_serial_num_;
};
}
}
#endif
|
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RECOVERY_INSTALL_H_
#define RECOVERY_INSTALL_H_
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE };
// Install the package specified by root_path. If INSTALL_SUCCESS is
// returned and *wipe_cache is true on exit, caller should wipe the
// cache partition.
int install_package(const char *root_path, int* wipe_cache,
const char* install_file);
#ifdef __cplusplus
}
#endif
#endif // RECOVERY_INSTALL_H_
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkDiscreteGaussianCurvatureQuadEdgeMeshFilter_h
#define itkDiscreteGaussianCurvatureQuadEdgeMeshFilter_h
#include "itkDiscreteCurvatureQuadEdgeMeshFilter.h"
#include "itkMath.h"
namespace itk
{
/**
* \class DiscreteGaussianCurvatureQuadEdgeMeshFilter
* \brief see the following paper
* title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds
* authors: Mark Meyer, Mathieu Desbrun, Peter Schroder, Alan H. Barr
* conference: VisMath '02
* location: Berlin (Germany)
* \author: Arnaud Gelas, Alexandre Gouaillard
* \ingroup ITKQuadEdgeMeshFiltering
*/
template< typename TInputMesh, typename TOutputMesh=TInputMesh >
class DiscreteGaussianCurvatureQuadEdgeMeshFilter:
public DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
{
public:
typedef DiscreteGaussianCurvatureQuadEdgeMeshFilter Self;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
typedef DiscreteCurvatureQuadEdgeMeshFilter<
TInputMesh, TOutputMesh > Superclass;
typedef typename Superclass::InputMeshType InputMeshType;
typedef typename Superclass::InputMeshPointer InputMeshPointer;
typedef typename Superclass::OutputMeshType OutputMeshType;
typedef typename Superclass::OutputMeshPointer OutputMeshPointer;
typedef typename Superclass::OutputPointsContainerPointer OutputPointsContainerPointer;
typedef typename Superclass::OutputPointsContainerIterator OutputPointsContainerIterator;
typedef typename Superclass::OutputPointType OutputPointType;
typedef typename Superclass::OutputVectorType OutputVectorType;
typedef typename Superclass::OutputCoordType OutputCoordType;
typedef typename Superclass::OutputPointIdentifier OutputPointIdentifier;
typedef typename Superclass::OutputCellIdentifier OutputCellIdentifier;
typedef typename Superclass::OutputQEType OutputQEType;
typedef typename Superclass::OutputMeshTraits OutputMeshTraits;
typedef typename Superclass::OutputCurvatureType OutputCurvatureType;
typedef typename Superclass::TriangleType TriangleType;
/** Run-time type information (and related methods). */
itkTypeMacro(DiscreteGaussianCurvatureQuadEdgeMeshFilter, DiscreteCurvatureQuadEdgeMeshFilter);
/** New macro for creation of through a Smart Pointer */
itkNewMacro(Self);
#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
itkConceptMacro( OutputIsFloatingPointCheck,
( Concept::IsFloatingPoint< OutputCurvatureType > ) );
// End concept checking
#endif
protected:
DiscreteGaussianCurvatureQuadEdgeMeshFilter() {}
~DiscreteGaussianCurvatureQuadEdgeMeshFilter() {}
virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) ITK_OVERRIDE
{
OutputMeshPointer output = this->GetOutput();
OutputQEType *qe = iP.GetEdge();
if ( qe != ITK_NULLPTR )
{
OutputQEType *qe_it = qe;
OutputQEType *qe_it2;
OutputPointType q0, q1;
OutputCurvatureType sum_theta = 0.;
OutputCurvatureType area = 0.;
do
{
// cell_id = qe_it->GetLeft();
qe_it2 = qe_it->GetOnext();
q0 = output->GetPoint( qe_it->GetDestination() );
q1 = output->GetPoint( qe_it2->GetDestination() );
// Compute Angle;
sum_theta += static_cast< OutputCurvatureType >(
TriangleType::ComputeAngle(q0, iP, q1) );
area += this->ComputeMixedArea(qe_it, qe_it2);
qe_it = qe_it2;
}
while ( qe_it != qe );
return ( 2.0 * itk::Math::pi - sum_theta ) / area;
}
return 0.;
}
private:
DiscreteGaussianCurvatureQuadEdgeMeshFilter(const Self &) ITK_DELETE_FUNCTION;
void operator=(const Self &) ITK_DELETE_FUNCTION;
};
}
#endif
|
//
// AppDelegate.h
// Boom
//
// Created by Jay on 3/6/2019.
// Copyright © 2019 AA. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/* $NetBSD: page.c,v 1.1.1.1 2006/02/06 18:14:54 wiz Exp $ */
/*
* page.c
*
* map page numbers to file position
*/
#include <X11/Xos.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <stdio.h>
#include <ctype.h>
#include "DviP.h"
#ifdef X_NOT_STDC_ENV
extern long ftell();
#endif
static DviFileMap *
MapPageNumberToFileMap (DviWidget dw, int number)
{
DviFileMap *m;
for (m = dw->dvi.file_map; m; m=m->next)
if (m->page_number == number)
break;
return m;
}
void
DestroyFileMap (DviFileMap *m)
{
DviFileMap *next;
for (; m; m = next) {
next = m->next;
XtFree ((char *) m);
}
}
void
ForgetPagePositions (DviWidget dw)
{
DestroyFileMap (dw->dvi.file_map);
dw->dvi.file_map = 0;
}
void
RememberPagePosition(DviWidget dw, int number)
{
DviFileMap *m;
if (!(m = MapPageNumberToFileMap (dw, number))) {
m = (DviFileMap *) XtMalloc (sizeof *m);
m->page_number = number;
m->next = dw->dvi.file_map;
dw->dvi.file_map = m;
}
if (dw->dvi.tmpFile)
m->position = ftell (dw->dvi.tmpFile);
else
m->position = ftell (dw->dvi.file);
}
long
SearchPagePosition (DviWidget dw, int number)
{
DviFileMap *m;
if (!(m = MapPageNumberToFileMap (dw, number)))
return -1;
return m->position;
}
void
FileSeek(DviWidget dw, long position)
{
if (dw->dvi.tmpFile) {
dw->dvi.readingTmp = 1;
fseek (dw->dvi.tmpFile, position, 0);
} else
fseek (dw->dvi.file, position, 0);
}
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/discovery/ApplicationDiscoveryService_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace ApplicationDiscoveryService
{
namespace Model
{
enum class BatchDeleteImportDataErrorCode
{
NOT_SET,
NOT_FOUND,
INTERNAL_SERVER_ERROR,
OVER_LIMIT
};
namespace BatchDeleteImportDataErrorCodeMapper
{
AWS_APPLICATIONDISCOVERYSERVICE_API BatchDeleteImportDataErrorCode GetBatchDeleteImportDataErrorCodeForName(const Aws::String& name);
AWS_APPLICATIONDISCOVERYSERVICE_API Aws::String GetNameForBatchDeleteImportDataErrorCode(BatchDeleteImportDataErrorCode value);
} // namespace BatchDeleteImportDataErrorCodeMapper
} // namespace Model
} // namespace ApplicationDiscoveryService
} // namespace Aws
|
/*
Copyright 2016, Michael R. Hoopmann, Institute for Systems Biology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _CGRAPHIC_H
#define _CGRAPHIC_H
#ifdef GCC
#include <SDL2/SDL.h>
#else
#include <SDL.h>
#endif
#include <stdio.h>
#include <string>
using namespace std;
class CGraphic {
public:
CGraphic();
~CGraphic();
SDL_Texture* texture;
SDL_Surface* surface;
bool createImages(int szX, int szY, int canX, int canY);
bool createImages(char* fn);
SDL_Rect getRect(int index);
bool loadTexture(char* fn, SDL_Renderer* rend, bool surf=false, bool alpha=false, Uint8 r=0, Uint8 g=0, Uint8 b=0);
void render(SDL_Renderer* rend, int index, int posX, int posY, int w=0, int h=0);
int size();
private:
int imageCount;
SDL_Rect* images;
};
#endif
|
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2012 EMC Corp.
//
// @filename:
// CSocketConnector.h
//
// @doc:
// Creates socket to connect with remote host
//
// @owner:
//
// @test:
//
//
//---------------------------------------------------------------------------
#ifndef GPOS_CSocketConnector_H
#define GPOS_CSocketConnector_H
#include "gpos/base.h"
#include "gpos/net/CSocket.h"
namespace gpos
{
//---------------------------------------------------------------------------
// @class:
// CSocketConnector
//
// @doc:
// Abstraction for creating socket to connect with remote host
//
//---------------------------------------------------------------------------
class CSocketConnector
{
private:
// no copy ctor
CSocketConnector(const CSocketConnector&);
protected:
// socket
CSocket *m_psocket;
// internal memory pool
IMemoryPool *m_pmp;
public:
// ctor
explicit
CSocketConnector
(
IMemoryPool *pmp
)
:
m_psocket(NULL),
m_pmp(pmp)
{
GPOS_ASSERT(NULL != pmp);
}
// dtor
virtual
~CSocketConnector()
{
GPOS_DELETE(m_psocket);
}
// connect to remote host
virtual
void Connect() = 0;
// socket accessor
CSocket *Psocket() const
{
GPOS_ASSERT(NULL != m_psocket);
return m_psocket;
}
}; // class CSocketConnector
}
#endif // !GPOS_CSocketConnector_H
// EOF
|
// Copyright 2010-2021 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef OR_TOOLS_MATH_OPT_VALIDATORS_MODEL_VALIDATOR_H_
#define OR_TOOLS_MATH_OPT_VALIDATORS_MODEL_VALIDATOR_H_
#include "absl/status/status.h"
#include "ortools/math_opt/core/model_summary.h"
#include "ortools/math_opt/model.pb.h"
#include "ortools/math_opt/model_update.pb.h"
namespace operations_research {
namespace math_opt {
absl::Status ValidateModel(const ModelProto& model, bool check_names = true);
// Performance: runs in O(size of update).
absl::Status ValidateModelUpdate(const ModelUpdateProto& model_update,
bool check_names = true);
// Performance: runs in O(size of update), allocates at most
// O(#new or deleted variables + #new or deleted linear constraints).
absl::Status ValidateModelUpdateAndSummary(const ModelUpdateProto& model_update,
const ModelSummary& model_summary,
bool check_names = true);
} // namespace math_opt
} // namespace operations_research
#endif // OR_TOOLS_MATH_OPT_VALIDATORS_MODEL_VALIDATOR_H_
|
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "lldb/API/SBExpressionOptions.h"
#include "ManagedUniquePtr.h"
namespace YetiVSI {
namespace DebugEngine {
using namespace LldbApi;
private
ref class LLDBExpressionOptions sealed : SbExpressionOptions {
public:
LLDBExpressionOptions();
virtual ~LLDBExpressionOptions(){};
virtual void SetAutoApplyFixIts(bool b);
virtual void SetIgnoreBreakpoints(bool b);
lldb::SBExpressionOptions GetNativeObject();
private:
ManagedUniquePtr<lldb::SBExpressionOptions> ^ expression_options_;
};
} // namespace DebugEngine
} // namespace YetiVSI
|
/*
* Copyright 2014-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <folly/futures/Future.h>
#include <folly/futures/Timekeeper.h>
#include <folly/io/async/EventBase.h>
#include <folly/io/async/HHWheelTimer.h>
#include <thread>
namespace folly {
/// The default Timekeeper implementation which uses a HHWheelTimer on an
/// EventBase in a dedicated thread. Users needn't deal with this directly, it
/// is used by default by Future methods that work with timeouts.
class ThreadWheelTimekeeper : public Timekeeper {
public:
/// But it doesn't *have* to be a singleton.
ThreadWheelTimekeeper();
~ThreadWheelTimekeeper() override;
/// Implement the Timekeeper interface
/// This future *does* complete on the timer thread. You should almost
/// certainly follow it with a via() call or the accuracy of other timers
/// will suffer.
Future<Unit> after(Duration) override;
protected:
folly::EventBase eventBase_;
std::thread thread_;
HHWheelTimer::UniquePtr wheelTimer_;
};
} // namespace folly
|
//===--- SyntaxCollectionData.h ---------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SYNTAX_SYNTAXCOLLECTIONDATA_H
#define SWIFT_SYNTAX_SYNTAXCOLLECTIONDATA_H
#include "swift/Syntax/SyntaxData.h"
namespace swift {
namespace syntax {
template <SyntaxKind CollectionKind, typename ElementType>
class SyntaxCollection;
template <SyntaxKind CollectionKind, typename ElementType>
class SyntaxCollectionData : public SyntaxData {
friend class SyntaxCollection<CollectionKind, ElementType>;
std::vector<RC<typename ElementType::DataType>> CachedElements;
friend struct SyntaxFactory;
friend class SyntaxData;
friend class FunctionCallExprSyntaxBuilder;
SyntaxCollectionData(RC<RawSyntax> Raw, const SyntaxData *Parent = nullptr,
CursorIndex IndexInParent = 0)
: SyntaxData(Raw, Parent, IndexInParent),
CachedElements(Raw->Layout.size(), nullptr) {
assert(Raw->Kind == CollectionKind);
}
static RC<SyntaxCollectionData<CollectionKind, ElementType>>
make(RC<RawSyntax> Raw, const SyntaxData *Parent = nullptr,
CursorIndex IndexInParent = 0) {
return RC<SyntaxCollectionData<CollectionKind, ElementType>> {
new SyntaxCollectionData<CollectionKind, ElementType> {
Raw, Parent, IndexInParent
}
};
}
static RC<SyntaxCollectionData<CollectionKind, ElementType>> makeBlank() {
auto Raw = RawSyntax::make(CollectionKind, {}, SourcePresence::Present);
return make(Raw);
}
public:
static bool classof(const SyntaxData *SD) {
return SD->getKind() == CollectionKind;
}
};
} // end namespace syntax
} // end namespace swift
#endif
|
//set bg and spr palettes, data is 32 bytes array
void __fastcall__ pal_all(const char *data);
//set bg palette only, data is 16 bytes array
void __fastcall__ pal_bg(const char *data);
//set spr palette only, data is 16 bytes array
void __fastcall__ pal_spr(const char *data);
//set a palette entry, index is 0..31
void __fastcall__ pal_col(unsigned char index,unsigned char color);
//reset palette to $0f
void __fastcall__ pal_clear(void);
//fade current palette one brightness step to black
void __fastcall__ pal_fade(void);
//fade in current palette one brightess step to given one, both for bg and spr
void __fastcall__ pal_fade_to_all(const unsigned char *pal);
//fade in for bg only
void __fastcall__ pal_fade_to_bg(const unsigned char *pal);
//fade in for spr only
void __fastcall__ pal_fade_to_spr(const unsigned char *pal);
//turn off rendering and nmi
void __fastcall__ ppu_off(void);
//turn on bg, spr, and nmi
void __fastcall__ ppu_on_all(void);
//turn on bg only and nmi
void __fastcall__ ppu_on_bg(void);
//turn on spr only and nmi
void __fastcall__ ppu_on_spr(void);
//clear OAM buffer, all the sprites are hidden
void __fastcall__ oam_clear(void);
//set sprite in OAM buffer, chrnum is tile, attr is attribute, sprid is offset in OAM in bytes
//returns sprid+4, which is offset for next sprite
unsigned char __fastcall__ oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr,unsigned char sprid);
//set metasprite in OAM buffer
//meta sprite is a const unsigned char array, it contains four bytes per sprite
//in order x offset, y offset, tile, attribute
//x=128 is end of a meta sprite
//returns sprid+(number of sprites*4), which is offset for next sprite
unsigned char __fastcall__ oam_meta_spr(unsigned char x,unsigned char y,unsigned char sprid,const unsigned char *data);
//wait NMI and sync to 50hz (with frameskip for NTSC)
void __fastcall__ ppu_waitnmi(void);
//play a music in FamiTone format
void __fastcall__ music_play(const unsigned char *data);
//stop music
void __fastcall__ music_stop(void);
//pause and unpause music
void __fastcall__ music_pause(unsigned char pause);
//play FamiTone sound effect on channel 0..3
void __fastcall__ sfx_play(unsigned char sound,unsigned char channel);
//poll controller and return flags like PAD_LEFT etc
unsigned char __fastcall__ pad_poll(void);
//poll controller in trigger mode, a flag is set only on button down, not hold
unsigned char __fastcall__ pad_trigger(void);
//unpack a nametable into vram
void __fastcall__ unrle_vram(const unsigned char *data,unsigned int vram);
//set scroll, including top bits
void __fastcall__ scroll(unsigned int x,unsigned int y);
//select current chr bank for sprites, 0..1
void __fastcall__ bank_spr(unsigned char n);
//select current chr bank for background, 0..1
void __fastcall__ bank_bg(unsigned char n);
//read block of vram, works only when rendering is turned off
void __fastcall__ vram_read(unsigned char *dst,unsigned int adr,unsigned int size);
//returns random number 0..255
unsigned char __fastcall__ rand(void);
//set random seed
void __fastcall__ setrand(unsigned char seed);
//set a pointer to update buffer, contents of the buffer is transferred to vram every frame
//buffer structure is MSB, LSB, byte to write, len is number of entries (not bytes)
//could be set during rendering, but only takes effect on a new frame
//number of transferred bytes is limited by vblank time
void __fastcall__ set_vram_update(unsigned char len,unsigned char *buf);
//set vram pointer to write operations if you need to write some data to vram
//works only when rendering is turned off
void __fastcall__ vram_adr(unsigned int adr);
//put a byte at current vram address, works only when rendering is turned off
void __fastcall__ vram_put(unsigned char n);
//fill a block with a byte at current vram address, works only when rendering is turned off
void __fastcall__ vram_fill(unsigned char n,unsigned char len);
//set vram autoincrement, 0 for +1 and not 0 for +32
void __fastcall__ vram_inc(unsigned char n);
//like a normal memcpy, but does not return anything
void __fastcall__ memcpy(void *dst,void *src,unsigned int len);
#define PAD_A 0x01
#define PAD_B 0x02
#define PAD_SELECT 0x04
#define PAD_START 0x08
#define PAD_UP 0x10
#define PAD_DOWN 0x20
#define PAD_LEFT 0x40
#define PAD_RIGHT 0x80
#define OAM_FLIP_V 0x80
#define OAM_FLIP_H 0x40
#define MAX(x1,x2) (x1<x2?x2:x1)
#define MIN(x1,x2) (x1<x2?x1:x2) |
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <assert.h>
#include <exception>
// System.Text.RegularExpressions.Interpreter/IntStack
struct IntStack_t3630763131;
struct IntStack_t3630763131_marshaled_pinvoke;
struct IntStack_t3630763131_marshaled_com;
#include "codegen/il2cpp-codegen.h"
#include "System_System_Text_RegularExpressions_Interpreter_3630763131.h"
// System.Int32 System.Text.RegularExpressions.Interpreter/IntStack::Pop()
extern "C" int32_t IntStack_Pop_m1434102286 (IntStack_t3630763131 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void System.Text.RegularExpressions.Interpreter/IntStack::Push(System.Int32)
extern "C" void IntStack_Push_m2506448672 (IntStack_t3630763131 * __this, int32_t ___value0, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 System.Text.RegularExpressions.Interpreter/IntStack::get_Count()
extern "C" int32_t IntStack_get_Count_m897242211 (IntStack_t3630763131 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void System.Text.RegularExpressions.Interpreter/IntStack::set_Count(System.Int32)
extern "C" void IntStack_set_Count_m518204432 (IntStack_t3630763131 * __this, int32_t ___value0, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// Methods for marshaling
struct IntStack_t3630763131;
struct IntStack_t3630763131_marshaled_pinvoke;
extern "C" void IntStack_t3630763131_marshal_pinvoke(const IntStack_t3630763131& unmarshaled, IntStack_t3630763131_marshaled_pinvoke& marshaled);
extern "C" void IntStack_t3630763131_marshal_pinvoke_back(const IntStack_t3630763131_marshaled_pinvoke& marshaled, IntStack_t3630763131& unmarshaled);
extern "C" void IntStack_t3630763131_marshal_pinvoke_cleanup(IntStack_t3630763131_marshaled_pinvoke& marshaled);
// Methods for marshaling
struct IntStack_t3630763131;
struct IntStack_t3630763131_marshaled_com;
extern "C" void IntStack_t3630763131_marshal_com(const IntStack_t3630763131& unmarshaled, IntStack_t3630763131_marshaled_com& marshaled);
extern "C" void IntStack_t3630763131_marshal_com_back(const IntStack_t3630763131_marshaled_com& marshaled, IntStack_t3630763131& unmarshaled);
extern "C" void IntStack_t3630763131_marshal_com_cleanup(IntStack_t3630763131_marshaled_com& marshaled);
|
/**
* Here, we change certain linkages in server.c to external.
*/
#ifndef _SERVER_STUBS_H_
#define _SERVER_STUBS_H_
#include <lighttpd/server.h>
// Server memory management that we need to create our server test stubs.
server *server_init(void);
void server_free(server *srv);
#endif // _SERVER_STUBS_H_
|
/* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
//
// The following methods are ONLY for use by _ASDisplayLayer, _ASDisplayView, and ASDisplayNode.
// These methods must never be called or overridden by other classes.
//
#import "_ASDisplayLayer.h"
#import "_AS-objc-internal.h"
#import "ASDisplayNodeExtraIvars.h"
#import "ASDisplayNode.h"
#import "ASSentinel.h"
#import "ASThread.h"
BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector);
@class _ASPendingState;
// Allow 2^n increments of begin disabling hierarchy notifications
#define visibilityNotificationsDisabledBits 4
#define TIME_DISPLAYNODE_OPS (DEBUG || PROFILE)
@interface ASDisplayNode () <_ASDisplayLayerDelegate>
{
@protected
ASDN::RecursiveMutex _propertyLock; // Protects access to the _view, _pendingViewState, _subnodes, _supernode, _renderingSubnodes, and other properties which are accessed from multiple threads.
ASDisplayNode * __weak _supernode;
ASSentinel *_displaySentinel;
ASSentinel *_replaceAsyncSentinel;
// This is the desired contentsScale, not the scale at which the layer's contents should be displayed
CGFloat _contentsScaleForDisplay;
CGSize _size;
CGSize _constrainedSize;
UIEdgeInsets _hitTestSlop;
NSMutableArray *_subnodes;
Class _viewClass;
Class _layerClass;
UIView *_view;
CALayer *_layer;
_ASPendingState *_pendingViewState;
struct {
unsigned implementsDisplay:1;
unsigned isSynchronous:1;
unsigned isLayerBacked:1;
unsigned sizeCalculated:1;
unsigned preventOrCancelDisplay:1;
unsigned displaysAsynchronously:1;
unsigned shouldRasterizeDescendants:1;
unsigned visibilityNotificationsDisabled:visibilityNotificationsDisabledBits;
unsigned isInAppear:1;
unsigned isInDisappear:1;
unsigned inWindow:1;
unsigned hasWillDisplayAsyncLayer:1;
unsigned hasDrawParametersForAsyncLayer:1;
unsigned hasClassDisplay:1;
} _flags;
ASDisplayNodeExtraIvars _extra;
#if TIME_DISPLAYNODE_OPS
@public
NSTimeInterval _debugTimeToCreateView;
NSTimeInterval _debugTimeToApplyPendingState;
NSTimeInterval _debugTimeToAddSubnodeViews;
NSTimeInterval _debugTimeForDidLoad;
#endif
}
// The _ASDisplayLayer backing the node, if any.
@property (nonatomic, readonly, retain) _ASDisplayLayer *asyncLayer;
// Creates a pendingViewState if one doesn't exist. Allows setting view properties on a bg thread before there is a view.
@property (atomic, retain, readonly) _ASPendingState *pendingViewState;
// Swizzle to extend the builtin functionality with custom logic
- (BOOL)__shouldLoadViewOrLayer;
- (BOOL)__shouldSize;
- (void)__layout;
- (void)__setSupernode:(ASDisplayNode *)supernode;
// The visibility state of the node. Changed before calling willAppear, willDisappear, and didDisappear.
@property (nonatomic, readwrite, assign, getter = isInWindow) BOOL inWindow;
// Private API for helper funcitons / unit tests. Use ASDisplayNodeDisableHierarchyNotifications() to control this.
- (BOOL)__visibilityNotificationsDisabled;
- (void)__incrementVisibilityNotificationsDisabled;
- (void)__decrementVisibilityNotificationsDisabled;
// Call willAppear if necessary and set inWindow = YES if visibility notifications are enabled on all of its parents
- (void)__appear;
// Call willDisappear / didDisappear if necessary and set inWindow = NO if visibility notifications are enabled on all of its parents
- (void)__disappear;
// Returns the ancestor node that rasterizes descendants, or nil if none.
- (ASDisplayNode *)__rasterizedContainerNode;
@property (nonatomic, assign) CGFloat contentsScaleForDisplay;
@end
@interface UIView (ASDisplayNodeInternal)
@property (nonatomic, assign, readwrite) ASDisplayNode *asyncdisplaykit_node;
@end
@interface CALayer (ASDisplayNodeInternal)
@property (nonatomic, assign, readwrite) ASDisplayNode *asyncdisplaykit_node;
@end
|
/* Copyright 2015 Samsung Electronics Co., LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/***************************************************************************
* Bullet implementation of 3D world
***************************************************************************/
#ifndef BULLET_WORLD_H_
#define BULLET_WORLD_H_
#include "../physics_common.h"
#include "../physics_world.h"
#include <utility>
#include <map>
class btDynamicsWorld;
class btCollisionConfiguration;
class btCollisionDispatcher;
class btSequentialImpulseConstraintSolver;
class btBroadphaseInterface;
namespace gvr {
class PhysicsConstraint;
class PhysicsRigidBody;
class BulletWorld : public PhysicsWorld {
public:
BulletWorld();
~BulletWorld();
void addConstraint(PhysicsConstraint *constraint);
void removeConstraint(PhysicsConstraint *constraint);
void addRigidBody(PhysicsRigidBody *body);
void addRigidBody(PhysicsRigidBody *body, int collisiontype, int collidesWith);
void removeRigidBody(PhysicsRigidBody *body);
void step(float timeStep);
void listCollisions(std::list <ContactPoint> &contactPoints);
void setGravity(float x, float y, float z);
void setGravity(glm::vec3 gravity);
PhysicsVec3 getGravity() const;
static std::mutex worldLock;
private:
void initialize();
void finalize();
private:
std::map<std::pair <long,long>, ContactPoint> prevCollisions;
btDynamicsWorld *mPhysicsWorld;
btCollisionConfiguration *mCollisionConfiguration;
btCollisionDispatcher *mDispatcher;
btSequentialImpulseConstraintSolver *mSolver;
btBroadphaseInterface *mOverlappingPairCache;
//void (*gTmpFilter)(); // btNearCallback
//int gNearCallbackCount = 0;
//void *gUserData = 0;
};
}
#endif /* BULLET_WORLD_H_ */
|
/*
* Copyright 2020 The TensorFlow Runtime Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Declares utils for concatenating and parsing task names.
#ifndef TFRT_DISTRIBUTED_RUNTIME_TASK_NAME_UTIL_H_
#define TFRT_DISTRIBUTED_RUNTIME_TASK_NAME_UTIL_H_
#include <string>
#include "tfrt/support/forward_decls.h"
namespace tfrt {
class TaskNameUtil {
public:
// Concatenate job name and task id to get full task name
// e.g., "/job:worker/task:1"
static std::string ConcatTaskName(string_view job_name, int task_id);
// Concatenate job name, task id, and device name to get fully specified
// device name, e.g., "/job:worker/task:1/device:CPU:0"
static std::string ConcatDeviceName(string_view job_name, int task_id,
string_view device_name);
// Maybe strip the job name and task name from device name.
static std::string StripDevicePrefix(string_view device_name);
// Parse a full task name (e.g., "/job:worker/task:1") to extract the job name
// (e.g., "worker") and task id (e.g., 1)
//
// An acceptable task name should be in the following format:
// /job:<job-name>/task:<task-id>[/device:<device-type>:<device-id>]
//
// * Job name: starts with letter, may have letters, digits, underscores
// * Task id: non-negative integer (no leading zeros)
// * Device info is optional and will be ignored in parsing task names
static Error ParseTaskName(string_view task_name, std::string* out_job_name,
int* out_task_id);
// If this is called, "/replica:0" will be added as prefix of task_name.
static void SetUseReplicaInTaskName();
};
} // namespace tfrt
#endif // TFRT_DISTRIBUTED_RUNTIME_TASK_NAME_UTIL_H_
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Ivan Volosyuk
*/
typedef fast_list<Slot,65536> roots_vector;
extern roots_vector root_set;
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/imagebuilder/Imagebuilder_EXPORTS.h>
#include <aws/imagebuilder/ImagebuilderRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace imagebuilder
{
namespace Model
{
/**
*/
class AWS_IMAGEBUILDER_API PutComponentPolicyRequest : public ImagebuilderRequest
{
public:
PutComponentPolicyRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "PutComponentPolicy"; }
Aws::String SerializePayload() const override;
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline const Aws::String& GetComponentArn() const{ return m_componentArn; }
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline bool ComponentArnHasBeenSet() const { return m_componentArnHasBeenSet; }
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline void SetComponentArn(const Aws::String& value) { m_componentArnHasBeenSet = true; m_componentArn = value; }
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline void SetComponentArn(Aws::String&& value) { m_componentArnHasBeenSet = true; m_componentArn = std::move(value); }
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline void SetComponentArn(const char* value) { m_componentArnHasBeenSet = true; m_componentArn.assign(value); }
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline PutComponentPolicyRequest& WithComponentArn(const Aws::String& value) { SetComponentArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline PutComponentPolicyRequest& WithComponentArn(Aws::String&& value) { SetComponentArn(std::move(value)); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the component that this policy should be
* applied to. </p>
*/
inline PutComponentPolicyRequest& WithComponentArn(const char* value) { SetComponentArn(value); return *this;}
/**
* <p>The policy to apply. </p>
*/
inline const Aws::String& GetPolicy() const{ return m_policy; }
/**
* <p>The policy to apply. </p>
*/
inline bool PolicyHasBeenSet() const { return m_policyHasBeenSet; }
/**
* <p>The policy to apply. </p>
*/
inline void SetPolicy(const Aws::String& value) { m_policyHasBeenSet = true; m_policy = value; }
/**
* <p>The policy to apply. </p>
*/
inline void SetPolicy(Aws::String&& value) { m_policyHasBeenSet = true; m_policy = std::move(value); }
/**
* <p>The policy to apply. </p>
*/
inline void SetPolicy(const char* value) { m_policyHasBeenSet = true; m_policy.assign(value); }
/**
* <p>The policy to apply. </p>
*/
inline PutComponentPolicyRequest& WithPolicy(const Aws::String& value) { SetPolicy(value); return *this;}
/**
* <p>The policy to apply. </p>
*/
inline PutComponentPolicyRequest& WithPolicy(Aws::String&& value) { SetPolicy(std::move(value)); return *this;}
/**
* <p>The policy to apply. </p>
*/
inline PutComponentPolicyRequest& WithPolicy(const char* value) { SetPolicy(value); return *this;}
private:
Aws::String m_componentArn;
bool m_componentArnHasBeenSet;
Aws::String m_policy;
bool m_policyHasBeenSet;
};
} // namespace Model
} // namespace imagebuilder
} // namespace Aws
|
/*
* twemproxy - A fast and lightweight proxy for memcached protocol.
* Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NC_THREAD_H_
#define _NC_THREAD_H_
STAILQ_HEAD(sulist, swapunit);
struct thread_data {
int id;
pthread_t thread_id;
struct instance *nci;
struct context *ctx;
int socketpairs[2]; /*0: belong to master, 1: belong to worker*/
struct conn *notice;
struct sulist sul;
pthread_mutex_t sullock;
struct thread_stats *tstats;
};
struct swapunit {
int sd;
uint32_t pool_id;
struct swapunit *next;
STAILQ_ENTRY(swapunit) nextsu; /* next swapunit */
};
struct swapunit *sui_new(void);
void sui_free(struct swapunit *item);
int thread_data_init(struct thread_data *tdata);
void thread_data_deinit(struct thread_data *tdata);
struct swapunit *sul_pop(struct thread_data *tdata);
void sul_push(struct thread_data *tdata, struct swapunit *su);
void dispatch_conn_new(int sd, uint32_t pool_id, struct array *workers);
rstatus_t notice_recv(struct context *ctx, struct conn *conn);
void notice_ref(struct conn *conn, void *owner);
void notice_unref(struct conn *conn);
int setup_worker(struct thread_data *worker);
int master_run(struct instance *nci, struct array *workers);
void *worker_thread_run(void *args);
#endif
|
struct oper { char code; int prio;};
struct oper operations [4] = {{ '*', 8 }, { '/', 8 }, {'+', 7 }, {'-', 7}};
bool digit (char c)
{
return '0'<=c && c<='9';
}
bool letter( char c)
{
return 'a'<=c && c<='z';
}
int opnum( char c)
{
return c == '*' ? 0 : c == '/' ? 1 : c == '+' ? 2 : c == '-' ? 3 : -1;
}
void main ()
{
char formula[ 5 ], res[ 10 ], c;
int sp = -1, i, rp = -1, p;
struct oper stack[5];
getid (formula);
printid (formula);
for (i=0; i<5; i++)
{
c = formula [i];
if (letter (c) || digit(c))
res[++rp] = c;
else if ( (p = opnum (c)) <0)
{
print ( "bad symbol\n");
goto badend;
}
else
{
int prio = operations [p].prio, j;
while ( sp>=0 && stack[sp].prio >= prio)
res[++rp] = stack [sp--].code;
stack[++sp] = { operations[p].code, prio };
}
}
badend:;
while (sp >= 0)
{
res[++rp] = stack[sp--].code;
}
printid(res);
}
|
//
// Copyright (c) 2014 Limit Point Systems, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Interface for class constant_eval_family
#ifndef CONSTANT_EVAL_FAMILY_H
#define CONSTANT_EVAL_FAMILY_H
#ifndef SHEAF_DLL_SPEC_H
#include "SheafSystem/sheaf_dll_spec.h"
#endif
#ifndef EVAL_FAMILY
#include "SheafSystem/eval_family.h"
#endif
namespace fiber_bundle
{
///
/// A family of section evaluators containing
/// members for constant functions on primitive cells.
///
class SHEAF_DLL_SPEC constant_eval_family : public eval_family
{
friend class eval_family;
public:
// CANONICAL MEMBERS
///
/// Copy constructor
///
///
constant_eval_family(const constant_eval_family& xother);
///
/// Virtual constructor;
/// makes a new instance of
/// the same type as this
///
virtual constant_eval_family* clone() const;
///
/// Destructor
///
virtual ~constant_eval_family();
///
/// Class invariant.
///
virtual bool invariant() const;
///
/// Conformance test; true if other conforms to this
///
virtual bool is_ancestor_of(const any* xother) const;
// CONSTANT_EVAL_FAMILY FACET
///
/// Creates an instance containing all the dlinear evaluators defined in
/// the namespace xname_space.
///
constant_eval_family(const namespace_poset& xname_space);
///
/// The name of this family.
///
virtual const std::string& class_name() const;
///
/// The name of this class of families.
///
static const std::string& static_class_name();
///
/// Initializes this to contain members for name space xname_space.
///
virtual void initialize(const namespace_poset& xname_space);
///
/// True if the dofs used by the members of this family are section values,
/// that is, the evaluators are interpolation functions.
///
virtual bool dofs_are_values() const;
///
/// True if the extrema (minima or maxima) of the members of this family
/// occur at the discretization points.
///
virtual bool extrema_are_dofs() const;
private:
///
/// Default constructor; disabled.
///
///
constant_eval_family();
};
} // namespace fiber_bundle
#endif // ifndef CONSTANT_EVAL_FAMILY_H
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2014 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifndef TIUITEXTWIDGETPROXY_H_
#define TIUITEXTWIDGETPROXY_H_
#include <TiCore.h>
#include "TiUITextWidget.h"
#include <bb/cascades/TextField>
#include <bb/cascades/TextArea>
#include <bb/cascades/AbstractTextControl>
namespace TiUI {
class TiUITextWidgetProxy : public Ti::TiViewProxy{
public:
TiUITextWidgetProxy(const char*);
virtual ~TiUITextWidgetProxy();
static Handle<Value> CreateTextArea(const Arguments&);
static Handle<Value> CreateTextField(const Arguments&);
void setView(Ti::TiView*);
void setAppearance(Ti::TiValue);
void setAutocapitalization(Ti::TiValue);
void setAutocorrect(Ti::TiValue);
void setAutoLink(Ti::TiValue);
void setBackgroundColor(Ti::TiValue);
void setClearOnEdit(Ti::TiValue);
void setColor(Ti::TiValue);
void setEditable(Ti::TiValue);
void setEllipsize(Ti::TiValue);
void setEnabled(Ti::TiValue);
void setEnableReturnKey(Ti::TiValue);
void setFont(Ti::TiValue);
void setHintText(Ti::TiValue);
void setKeyboardToolbar(Ti::TiValue);
void setKeyboardToolbarColor(Ti::TiValue);
void setKeyboardToolbarHeight(Ti::TiValue);
void setKeyboardType(Ti::TiValue);
void setMaxLength(Ti::TiValue);
void setReturnKeyType(Ti::TiValue);
void setSuppressReturn(Ti::TiValue);
void setTextAlign(Ti::TiValue);
void setValue(Ti::TiValue);
void setVerticalAlign(Ti::TiValue);
Ti::TiValue getAppearance();
Ti::TiValue getAutocapitalization();
Ti::TiValue getAutocorrect();
Ti::TiValue getAutoLink();
Ti::TiValue getClearOnEdit();
Ti::TiValue getColor();
Ti::TiValue getEditable();
Ti::TiValue getEllipsize();
Ti::TiValue getEnabled();
Ti::TiValue getEnableReturnKey();
Ti::TiValue getFont();
Ti::TiValue getHintText();
Ti::TiValue getKeyboardToolbar();
Ti::TiValue getKeyboardToolbarColor();
Ti::TiValue getKeyboardToolbarHeight();
Ti::TiValue getKeyboardType();
Ti::TiValue getMaxLength();
Ti::TiValue getReturnKeyType();
Ti::TiValue getSuppressReturn();
Ti::TiValue getTextAlign();
Ti::TiValue getValue();
Ti::TiValue getVerticalAlign();
Ti::TiValue blur(Ti::TiValue);
Ti::TiValue focus(Ti::TiValue);
Ti::TiValue hasText(Ti::TiValue);
Ti::TiValue setSelection(Ti::TiValue);
EXPOSE_SETTER(TiUITextWidgetProxy, setAppearance)
EXPOSE_SETTER(TiUITextWidgetProxy, setAutocapitalization)
EXPOSE_SETTER(TiUITextWidgetProxy, setAutocorrect)
EXPOSE_SETTER(TiUITextWidgetProxy, setAutoLink)
EXPOSE_SETTER(TiUITextWidgetProxy, setClearOnEdit)
EXPOSE_SETTER(TiUITextWidgetProxy, setColor)
EXPOSE_SETTER(TiUITextWidgetProxy, setEditable)
EXPOSE_SETTER(TiUITextWidgetProxy, setEllipsize)
EXPOSE_SETTER(TiUITextWidgetProxy, setEnabled)
EXPOSE_SETTER(TiUITextWidgetProxy, setEnableReturnKey)
EXPOSE_SETTER(TiUITextWidgetProxy, setFont)
EXPOSE_SETTER(TiUITextWidgetProxy, setHintText)
EXPOSE_SETTER(TiUITextWidgetProxy, setKeyboardToolbar)
EXPOSE_SETTER(TiUITextWidgetProxy, setKeyboardToolbarColor)
EXPOSE_SETTER(TiUITextWidgetProxy, setKeyboardToolbarHeight)
EXPOSE_SETTER(TiUITextWidgetProxy, setKeyboardType)
EXPOSE_SETTER(TiUITextWidgetProxy, setMaxLength)
EXPOSE_SETTER(TiUITextWidgetProxy, setReturnKeyType)
EXPOSE_SETTER(TiUITextWidgetProxy, setSuppressReturn)
EXPOSE_SETTER(TiUITextWidgetProxy, setTextAlign)
EXPOSE_SETTER(TiUITextWidgetProxy, setValue)
EXPOSE_SETTER(TiUITextWidgetProxy, setVerticalAlign)
EXPOSE_GETTER(TiUITextWidgetProxy, getAppearance)
EXPOSE_GETTER(TiUITextWidgetProxy, getAutocapitalization)
EXPOSE_GETTER(TiUITextWidgetProxy, getAutocorrect)
EXPOSE_GETTER(TiUITextWidgetProxy, getAutoLink)
EXPOSE_GETTER(TiUITextWidgetProxy, getClearOnEdit)
EXPOSE_GETTER(TiUITextWidgetProxy, getColor)
EXPOSE_GETTER(TiUITextWidgetProxy, getEditable)
EXPOSE_GETTER(TiUITextWidgetProxy, getEllipsize)
EXPOSE_GETTER(TiUITextWidgetProxy, getEnabled)
EXPOSE_GETTER(TiUITextWidgetProxy, getEnableReturnKey)
EXPOSE_GETTER(TiUITextWidgetProxy, getFont)
EXPOSE_GETTER(TiUITextWidgetProxy, getHintText)
EXPOSE_GETTER(TiUITextWidgetProxy, getKeyboardToolbar)
EXPOSE_GETTER(TiUITextWidgetProxy, getKeyboardToolbarColor)
EXPOSE_GETTER(TiUITextWidgetProxy, getKeyboardToolbarHeight)
EXPOSE_GETTER(TiUITextWidgetProxy, getKeyboardType)
EXPOSE_GETTER(TiUITextWidgetProxy, getMaxLength)
EXPOSE_GETTER(TiUITextWidgetProxy, getReturnKeyType)
EXPOSE_GETTER(TiUITextWidgetProxy, getSuppressReturn)
EXPOSE_GETTER(TiUITextWidgetProxy, getTextAlign)
EXPOSE_GETTER(TiUITextWidgetProxy, getValue)
EXPOSE_GETTER(TiUITextWidgetProxy, getVerticalAlign)
EXPOSE_METHOD(TiUITextWidgetProxy, blur)
EXPOSE_METHOD(TiUITextWidgetProxy, focus)
EXPOSE_METHOD(TiUITextWidgetProxy, hasText)
EXPOSE_METHOD(TiUITextWidgetProxy, setSelection)
void setIsTextArea(bool);
void setIsTextfield(bool);
bb::cascades::AbstractTextControl *getNativeTextControl();
private:
TiUITextWidget *_textWidget;
bb::cascades::AbstractTextControl *_nativeTextWidget;
bb::cascades::TextField *_textField;
bb::cascades::TextArea *_textArea;
bool _isTextArea;
bool _isTextfield;
};
} /* namespace TiUI */
#endif /* TIUITEXTWIDGETPROXY_H_ */
|
//
// LZEmotionAttachment.h
// LZWeiBo
//
// Created by apple on 16/4/4.
// Copyright © 2016年 m14a. All rights reserved.
//
#import <UIKit/UIKit.h>
@class LZEmotion;
@interface LZEmotionAttachment : NSTextAttachment
/** 表情数据*/
@property (nonatomic, strong) LZEmotion *emotion;
@end
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef HADOOP_MAIN_NATIVE_SRC_EXCEPTION_H
#define HADOOP_MAIN_NATIVE_SRC_EXCEPTION_H
#include <jni.h> /* for jthrowable */
#include <stdarg.h> /* for va_list */
#include "com_intel_cryptostream.h"
#ifdef WINDOWS
/*
* gcc-style type-checked format arguments are not supported on Windows, so just
* stub this macro.
*/
#define TYPE_CHECKED_PRINTF_FORMAT(formatArg, varArgs)
# else
/* Use gcc type-checked format arguments. */
#define TYPE_CHECKED_PRINTF_FORMAT(formatArg, varArgs) \
__attribute__((format(printf, formatArg, varArgs)))
#endif
/**
* Create a new Exception.
*
* No exceptions will be pending on return.
*
* @param env The JNI environment
* @param name full name of the Java exception class
* @param fmt printf-style format string
* @param ap printf-style arguments
*
* @return The RuntimeException
*/
jthrowable newExceptionV(JNIEnv* env, const char *name,
const char *fmt, va_list ap);
/**
* Create a new Exception.
*
* No exceptions will be pending on return.
*
* @param env The JNI environment
* @param name full name of the Java exception class
* @param fmt printf-style format string
* @param ... printf-style arguments
*
* @return The RuntimeException
*/
jthrowable newException(JNIEnv* env, const char *name, const char *fmt, ...)
TYPE_CHECKED_PRINTF_FORMAT(3, 4);
/**
* Create a new RuntimeException.
*
* No exceptions will be pending on return.
*
* @param env The JNI environment
* @param fmt printf-style format string
* @param ... printf-style arguments
*
* @return The RuntimeException
*/
jthrowable newRuntimeException(JNIEnv* env, const char *fmt, ...)
TYPE_CHECKED_PRINTF_FORMAT(2, 3);
/**
* Create a new IOException.
*
* No exceptions will be pending on return.
*
* @param env The JNI environment
* @param fmt printf-style format string
* @param ... printf-style arguments
*
* @return The IOException, or another exception if we failed
* to create the NativeIOException.
*/
jthrowable newIOException(JNIEnv* env, const char *fmt, ...)
TYPE_CHECKED_PRINTF_FORMAT(2, 3);
/**
* Thread-safe strerror alternative.
*
* @param errnum Error number.
* @return Statically allocated error string.
*/
const char* terror(int errnum);
#undef TYPE_CHECKED_PRINTF_FORMAT
#endif
|
//************************************************************************************
//
// LCD 16X2 (CLCD) Interface Library (Header File)
//
//************************************************************************************
#ifndef CLCD_H
#define CLCD_H
//*****USER SETTINGS************
#define DATA_PORT_SET IOSET0
#define DATA_PORT_CLR IOCLR0
#define DATA_DIR IODIR0
#define D7 20
#define D6 19
#define D5 18
#define D4 17
//Set data port pins
#define DATA_PORT (unsigned long)((1<<D7)|(1<<D6)|(1<<D5)|(1<<D4))
#define CTRL_PORT_SET IOSET0
#define CTRL_PORT_CLR IOCLR0
#define CTRL_DIR IODIR0
#define CTRL_RS 12
#define CTRL_EN 13
//***End of USER SETTINGS*******
//*******Public Protoype**********
#define ClcdPutCh(ch) ClcdSendByte(ch,1)
#define ClcdCursorOn() ClcdSendByte(0x0E,0)
#define ClcdCursorOff() ClcdSendByte(0x0C,0)
#define ClcdDisplayOff() ClcdSendByte(0x08,0)
#define ClcdDisplayOn() ClcdSendByte(0x0C,0)
#define ClcdCursorBlink() ClcdSendByte(0x0F,0)
void ClcdInit(void);
void ClcdSendByte(unsigned char byte,unsigned char type);
void ClcdGoto(unsigned char x,unsigned char y);
void ClcdPutS(void *str);
void ClcdPutS_P(const char *str);
void ClcdPutNum(int n);
void ClcdPutFloat(float f);
void ClcdClear(void);
//*****End of Public Protoype//*****
#endif //CLCD_H
|
#ifndef __GearBrowserTest_H__
#define __GearBrowserTest_H__
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "GearBrowserTest"
#if !defined(PACKAGE)
#define PACKAGE "org.example.gearbrowsertest"
#endif
#endif /* __GearBrowserTest_H__ */
|
#if !defined(AFX_BARSERIES_H__E7AEB173_E826_4154_AD34_A8D277A44525__INCLUDED_)
#define AFX_BARSERIES_H__E7AEB173_E826_4154_AD34_A8D277A44525__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
// Dispatch interfaces referenced by this interface
class CBrush1;
class CPen1;
class CGradient;
/////////////////////////////////////////////////////////////////////////////
// CBarSeries wrapper class
class CBarSeries : public COleDispatchDriver
{
public:
CBarSeries() {} // Calls COleDispatchDriver default constructor
CBarSeries(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CBarSeries(const CBarSeries& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
long GetMultiBar();
void SetMultiBar(long nNewValue);
BOOL GetAutoMarkPosition();
void SetAutoMarkPosition(BOOL bNewValue);
CBrush1 GetBarBrush();
CPen1 GetBarPen();
long GetBarStyle();
void SetBarStyle(long nNewValue);
long GetBarWidthPercent();
void SetBarWidthPercent(long nNewValue);
BOOL GetDark3D();
void SetDark3D(BOOL bNewValue);
long GetOffsetPercent();
void SetOffsetPercent(long nNewValue);
BOOL GetSideMargins();
void SetSideMargins(BOOL bNewValue);
BOOL GetUseOrigin();
void SetUseOrigin(BOOL bNewValue);
double GetOrigin();
void SetOrigin(double newValue);
long GetOriginPos(long SomeValueIndex);
BOOL GetAutoBarSize();
void SetAutoBarSize(BOOL bNewValue);
void BarImageLoad(LPCTSTR FileName);
void BarImageClear();
CGradient GetGradient();
long GetStackGroup();
void SetStackGroup(long nNewValue);
long GetConePercent();
void SetConePercent(long nNewValue);
long GetBarWidth();
void SetBarWidth(long nNewValue);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BARSERIES_H__E7AEB173_E826_4154_AD34_A8D277A44525__INCLUDED_)
|
//
// NWSXMLParser.h
// Spaghetti
//
// Copyright (c) 2012 noodlewerk. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "NWSParser.h"
/**
* A parser based on libxml2.
*/
@interface NWSXMLParser : NWSParser
@property (nonatomic, assign) BOOL isFoldArray;
@property (nonatomic, assign) BOOL isFoldContent;
@property (nonatomic, copy) NSString *attributeKeyFormatter;
@property (nonatomic, copy) NSString *contentKey;
/**
* NB: do not manipulate this instance; it's shared.
*/
+ (id)shared;
@end
|
/*
Copyright (c) 2011-2013, Sergey Usilin. All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of copyright holders.
*/
#pragma once
#ifndef MARKUPEDITOR_H_INCLUDED
#define MARKUPEDITOR_H_INCLUDED
#include <QGraphicsRectItem>
#include <QGraphicsScene>
#include <QUndoCommand>
#include <QUndoStack>
#include <QPixmap>
#include <QAction>
#include <QObject>
#include <QEvent>
#include <QSize>
class ObjedMarkup;
class ObjedMarkupEditor;
class StarImageCommand : public QUndoCommand
{
public:
StarImageCommand(bool starred, ObjedMarkupEditor *editor);
virtual void redo();
virtual void undo();
private:
ObjedMarkupEditor *editor;
bool starred;
};
class AppendObjectCommand : public QUndoCommand
{
public:
AppendObjectCommand(const QRect &object, ObjedMarkupEditor *editor);
virtual void redo();
virtual void undo();
private:
ObjedMarkupEditor *editor;
QRect object;
};
class RemoveObjectCommand : public QUndoCommand
{
public:
RemoveObjectCommand(const QRect &object, ObjedMarkupEditor *editor);
virtual void redo();
virtual void undo();
private:
ObjedMarkupEditor *editor;
QRect object;
};
class ModifyObjectCommand : public QUndoCommand
{
public:
ModifyObjectCommand(const QRect &oldObject, const QRect &newObject, ObjedMarkupEditor *editor);
virtual void redo();
virtual void undo();
private:
ObjedMarkupEditor *editor;
QRect oldObject, newObject;
};
class IdealObjectItem : public QGraphicsRectItem
{
Q_DISABLE_COPY(IdealObjectItem)
public:
IdealObjectItem(const QRect &objectRect,
const QColor &penColor, const QColor &brushColor, int width);
virtual ~IdealObjectItem();
public:
enum { Type = UserType + 1 };
int type() const { return Type; }
};
class RunObjectItem : public QGraphicsRectItem
{
Q_DISABLE_COPY(RunObjectItem)
public:
RunObjectItem(const QRect &objectRect,
const QColor &penColor, const QColor &brushColor, int width);
virtual ~RunObjectItem();
public:
enum { Type = UserType + 2 };
int type() const { return Type; }
};
class ObjedMarkupEditor : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(ObjedMarkupEditor)
friend StarImageCommand;
friend AppendObjectCommand;
friend RemoveObjectCommand;
friend ModifyObjectCommand;
public:
ObjedMarkupEditor(QGraphicsScene *scene, QObject *parent = 0);
virtual ~ObjedMarkupEditor();
public slots:
void update(const QPixmap &image, const QString &idealPath, const QString &runPath);
public:
QAction * undoAction() const;
QAction * redoAction() const;
QAction * increaseObjectSizeAction() const;
QAction * decreaseObjectSizeAction() const;
QAction * starImageAction() const;
QAction * lockStarStateAction() const;
QAction * objectSizePropertiesAction() const;
QAction * editorPropertiesAction() const;
QWidget * selectedObjectInfo() const;
QWidget * starImageInfo() const;
QWidget * lockStarStateInfo() const;
private slots:
void onResizeObjectAction();
void onStarImageAction();
void onLockStarStateAction();
void onObjectSizePropertiesAction();
void onEditorPropertiesAction();
private:
bool eventFilter(QObject *object, QEvent *event);
void updateSelectedObjectLabel();
void updateLockStarStateLabel();
void updateStarImageLabel();
void redraw();
private:
ObjedMarkup *idealMarkup;
ObjedMarkup *runMarkup;
private:
int idealObjectWidth, runObjectWidth, starZoneWidth;
QColor idealObjectPenColor, idealObjectBrushColor;
QColor runObjectPenColor, runObjectBrushColor;
QColor starZonePenColor, starZoneBrushColor;
bool repeatStar;
private:
QSize minimumObjectSize;
QSize maximumObjectSize;
QSize baseObjectSize;
QSize lastObjectSize;
bool baseObjectSizeEnabled;
private:
QGraphicsScene *scene;
IdealObjectItem *selectedIdealObject;
QGraphicsPixmapItem *lockedItem;
QGraphicsPixmapItem *starItem;
bool lastStarred;
bool lockedStarState;
bool creatingItem;
private:
QAction *undo, *redo;
QAction *increaseObjectSize;
QAction *decreaseObjectSize;
QAction *starImage, *lockStarState;
QAction *objectSizeProperties, *editorProperties;
private:
QWidget *selectedObjectWidget;
QWidget *starImageWidget;
QWidget *lockStarStateWidget;
private:
QUndoStack undoStack;
};
#endif // MARKUPEDITOR_H_INCLUDED |
/*-------------------------------------------------------------------------
*
* bootstrap.h
* include file for the bootstrapping code
*
*
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/bootstrap/bootstrap.h
*
*-------------------------------------------------------------------------
*/
#ifndef BOOTSTRAP_H
#define BOOTSTRAP_H
#include "nodes/execnodes.h"
typedef enum
{
CheckerProcess,
BootstrapProcess,
StartupProcess,
BgWriterProcess,
WalWriterProcess,
WalReceiverProcess,
NUM_AUXPROCTYPES /* Must be last! */
} AuxProcType;
/*
* MAXATTR is the maximum number of attributes in a relation supported
* at bootstrap time (i.e., the max possible in a system table).
*/
#define MAXATTR 40
extern Relation boot_reldesc;
extern Form_pg_attribute attrtypes[MAXATTR];
extern int numattr;
extern void AuxiliaryProcessMain(int argc, char *argv[]);
extern void err_out(void);
extern void closerel(char *name);
extern void boot_openrel(char *name);
extern void DefineAttr(char *name, char *type, int attnum);
extern void InsertOneTuple(Oid objectid);
extern void InsertOneValue(char *value, int i);
extern void InsertOneNull(int i);
extern char *MapArrayTypeName(char *s);
extern void index_register(Oid heap, Oid ind, IndexInfo *indexInfo);
extern void build_indices(void);
extern void boot_get_type_io_data(Oid typid,
int16 *typlen,
bool *typbyval,
char *typalign,
char *typdelim,
Oid *typioparam,
Oid *typinput,
Oid *typoutput);
extern int boot_yyparse(void);
extern int boot_yylex(void);
extern void boot_yyerror(const char *str);
#endif /* BOOTSTRAP_H */
|
#pragma once
//------------------------------------------------------------------------------
#include <iostream>
#include "chai3d.h"
//------------------------------------------------------------------------------
using namespace chai3d;
using namespace std;
class MyChevalet
{
public:
// membre
cMultiMesh* chevalet;
// fonctions
MyChevalet(std::string, double);
void setPositionAndRotation();
void enableTexture();
void setHapticProperties(double, double, double, double);
~MyChevalet();
};
|
/* Public domain */
#ifndef _AGAR_RG_PIXMAP_H_
#define _AGAR_RG_PIXMAP_H_
#include <agar/rg/begin.h>
#define RG_PIXMAP_NAME_MAX 32
struct ag_window;
struct ag_toolbar;
struct rg_pixmap;
struct rg_tileview;
enum rg_pixmap_mod_type {
RG_PIXMAP_PIXEL_REPLACE /* Single pixel replace */
};
typedef struct rg_pixmap_mod {
enum rg_pixmap_mod_type type;
Uint16 x, y; /* Coordinates of pixel in pixmap */
Uint32 val; /* Previous value */
} RG_PixmapMod;
typedef struct rg_pixmap_undoblk {
struct rg_pixmap_mod *mods; /* Undoable modifications */
Uint nmods;
} RG_PixmapUndoBlk;
enum rg_pixmap_blend_mode {
RG_PIXMAP_OVERLAY_ALPHA, /* dA = sA+dA */
RG_PIXMAP_AVERAGE_ALPHA, /* dA = (sA+dA)/2 */
RG_PIXMAP_DEST_ALPHA, /* dA = dA */
RG_PIXMAP_NO_BLENDING /* No blending done */
};
enum rg_brush_type {
RG_PIXMAP_BRUSH_MONO, /* Monochromatic (use current color) */
RG_PIXMAP_BRUSH_RGB /* Replace by brush color */
};
typedef struct rg_brush {
char name[RG_PIXMAP_NAME_MAX];
enum rg_brush_type type;
int flags;
#define RG_PIXMAP_BRUSH_ONESHOT 0x01 /* Don't mod the same pixel twice
in the same pass */
char px_name[RG_PIXMAP_NAME_MAX]; /* Pixmap reference */
struct rg_pixmap *px; /* Resolved pixmap */
AG_TAILQ_ENTRY(rg_brush) brushes;
} RG_Brush;
typedef struct rg_pixmap {
char name[RG_PIXMAP_NAME_MAX];
int flags;
int xorig, yorig; /* Pixmap origin point */
struct rg_tileset *ts; /* Back pointer to tileset */
AG_Surface *su; /* Pixmap surface */
Uint nrefs; /* Number of tile references */
struct rg_pixmap_undoblk *ublks; /* Undo blocks */
Uint nublks, curblk;
float h, s, v, a; /* Current pixel value */
RG_Brush *curbrush; /* Current brush */
enum rg_pixmap_blend_mode blend_mode; /* Current blending method */
AG_TAILQ_HEAD_(rg_brush) brushes; /* Brush references */
AG_TAILQ_ENTRY(rg_pixmap) pixmaps;
} RG_Pixmap;
__BEGIN_DECLS
RG_Pixmap *RG_PixmapNew(struct rg_tileset *, const char *, int);
void RG_PixmapInit(RG_Pixmap *, struct rg_tileset *, int);
void RG_PixmapDestroy(RG_Pixmap *);
int RG_PixmapLoad(RG_Pixmap *, AG_DataSource *);
void RG_PixmapSave(RG_Pixmap *, AG_DataSource *);
void RG_PixmapScale(RG_Pixmap *, int, int, int, int);
struct ag_window *RG_PixmapEdit(struct rg_tileview *, RG_TileElement *);
struct ag_toolbar *RG_PixmapToolbar(struct rg_tileview *, RG_TileElement *);
void RG_PixmapButtondown(struct rg_tileview *, RG_TileElement *, int, int, int);
void RG_PixmapButtonup(struct rg_tileview *, RG_TileElement *, int, int, int);
void RG_PixmapMotion(struct rg_tileview *, RG_TileElement *, int, int, int, int,
int);
int RG_PixmapWheel(struct rg_tileview *, RG_TileElement *, int);
void RG_PixmapKeydown(struct rg_tileview *, int);
void RG_PixmapKeyup(struct rg_tileview *);
void RG_PixmapBeginUndoBlk(RG_Pixmap *);
void RG_PixmapUndo(struct rg_tileview *, RG_TileElement *);
void RG_PixmapRedo(struct rg_tileview *, RG_TileElement *);
int RG_PixmapPutPixel(struct rg_tileview *, RG_TileElement *, int, int,
Uint32, int);
void RG_PixmapApplyBrush(struct rg_tileview *, RG_TileElement *, int, int,
Uint32);
Uint32 RG_PixmapSourcePixel(struct rg_tileview *, RG_TileElement *, int,
int);
void RG_PixmapSourceRGBA(struct rg_tileview *, RG_TileElement *, int, int,
Uint8 *, Uint8 *, Uint8 *, Uint8 *);
RG_Brush *RG_PixmapAddBrush(RG_Pixmap *, enum rg_brush_type, RG_Pixmap *);
void RG_PixmapDelBrush(RG_Pixmap *, RG_Brush *);
void RG_PixmapOpenMenu(struct rg_tileview *, int, int);
void RG_PixmapCloseMenu(struct rg_tileview *);
static __inline__ void
RG_PixmapSetBlendingMode(RG_Pixmap *pixmap, enum rg_pixmap_blend_mode bmode)
{
pixmap->blend_mode = bmode;
}
static __inline__ void
RG_PixmapSetBrush(RG_Pixmap *pixmap, RG_Brush *brush)
{
pixmap->curbrush = brush;
}
__END_DECLS
#include <agar/rg/close.h>
#endif /* _AGAR_RG_PIXMAP_H_ */
|
/**
* @file mega/attrmap.h
* @brief Class for manipulating file attributes
*
* (c) 2013-2014 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK 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.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/
#ifndef MEGA_ATTRMAP_H
#define MEGA_ATTRMAP_H 1
#include "mega/utils.h"
namespace mega {
// maps attribute names to attribute values
typedef map<nameid, string> attr_map;
struct MEGA_API AttrMap
{
attr_map map;
// compute rough storage size
unsigned storagesize(int) const;
// convert nameid to string
static int nameid2string(nameid, char*);
// convert string to nameid
static nameid string2nameid(const char *);
// export as JSON string
void getjson(string*) const;
// export as raw binary serialize
void serialize(string*) const;
// import raw binary serialize
const char* unserialize(const char*);
};
} // namespace
#endif
|
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
@interface MenuDelegate : NSObject
@property BOOL advanced;
@property NSMutableArray *advancedItems;
@property NSMutableArray *advancedProcesses;
@property BOOL toggleAnimation;
@property NSImage *animate;
@property NSImage *inanimate;
@property NSImage *indeterminate;
- (void)updateMenu:(NSMenu *)menu;
- (void)beginTracking:(NSMenu *)menu;
@end
|
#include "framework.h"
#include <memory>
#include "avkit/av_packet.h"
class jpeg_encoder_test : public test_fixture
{
public:
TEST_SUITE(jpeg_encoder_test);
TEST(jpeg_encoder_test::test_constructor);
TEST(jpeg_encoder_test::test_encode);
TEST_SUITE_END();
virtual ~jpeg_encoder_test() throw() {}
void setup();
void teardown();
void test_constructor();
void test_encode();
private:
std::shared_ptr<avkit::av_packet> _pic;
};
|
/************************************************************************************
Filename : MovieCategoryComponent.h
Content : Menu component for the movie category menu.
Created : August 13, 2014
Authors : Jim Dosé
Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the Cinema/ directory. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
*************************************************************************************/
#include "VRMenu/VRMenuComponent.h"
#include "MovieManager.h"
#if !defined( MovieCategoryComponent_h )
#define MovieCategoryComponent_h
using namespace OVR;
namespace OculusCinema {
class MovieSelectionView;
//==============================================================
// MovieCategoryComponent
class MovieCategoryComponent : public VRMenuComponent
{
public:
MovieCategoryComponent( MovieSelectionView *view, MovieCategory category );
static const Vector4f HighlightColor;
static const Vector4f FocusColor;
static const Vector4f NormalColor;
private:
SoundLimiter Sound;
bool HasFocus;
MovieCategory Category;
MovieSelectionView * CallbackView;
private:
virtual eMsgStatus OnEvent_Impl( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr,
VRMenuObject * self, VRMenuEvent const & event );
void UpdateColor( VRMenuObject * self );
eMsgStatus Frame( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr,
VRMenuObject * self, VRMenuEvent const & event );
eMsgStatus FocusGained( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr,
VRMenuObject * self, VRMenuEvent const & event );
eMsgStatus FocusLost( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr,
VRMenuObject * self, VRMenuEvent const & event );
};
} // namespace OculusCinema
#endif // MovieCategoryComponent_h
|
/*
* $Id$
*
* Copyright (c) 2011 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
*
* String utilities
*/
#include "config.h"
#include "shared/str.h"
#include "shared/log.h"
#include <errno.h>
#include <stdio.h> /* snprintf() */
#include <string.h> /* strlen(), strcpy() */
#include <ctype.h> /* isspace() */
static const char *module_str = "str";
int ods_str_explode(char *buf, int argc, const char *argv[])
{
int narg = 0;
if (buf && strlen(buf)) {
char *p = buf;
char *pend = p+strlen(p);
do {
for (; p<pend && isspace(*p); ++p) {
*p = '\0'; /* zero-out space characters */
}
if (p < pend) {
if (narg < argc) {
argv[narg++] = p;
} else {
++narg;
}
for (; p<pend && !isspace(*p); ++p) {
/* skip argv value itself */
}
}
} while (p<pend);
}
return narg;
}
/**
* Join arguments together with a join character into a single string.
*
*/
char *
ods_str_join(allocator_type* allocator, int argc, char *argv[], char cjoin)
{
char* buf = NULL;
int c;
int options_size = 0;
for (c = 0; c < argc; ++c)
options_size += strlen(argv[c]) + 1;
if (options_size > 0) {
buf = (char*) allocator_alloc(allocator, (options_size+1) * sizeof(char));
/* allocator_alloc will terminate on memory allocation
* problems, so buf is always assigned when we get here.
*/
options_size = 0;
for (c = 0; c < argc; ++c) {
(void)strcpy(&buf[options_size], argv[c]);
options_size += strlen(argv[c])+1;
buf[options_size-1] = cjoin; /* put join character instead of 0 */
}
buf[options_size-1] = '\0'; /* replace join character with 0 */
buf[options_size] = '\0'; /* set last character in buf to 0 */
}
return buf;
}
/**
* Version of ctime_r that does not feature a trailing '\n' character
*
*/
char *
ods_ctime_r(char *buf, size_t nbuf, time_t t)
{
#if 0
struct tm datetime;
if (localtime_r(&t,&datetime) == NULL) {
ods_log_error("[%s] time_datestamp: localtime_r() failed",
module_str);
return NULL;
}
snprintf(buf, nbuf, "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
1900+datetime.tm_year, datetime.tm_mon + 1, datetime.tm_mday,
datetime.tm_hour, datetime.tm_min, datetime.tm_sec);
return buf;
#else
if (nbuf>=26 && buf!=NULL) {
char *p;
char *pbeg = ctime_r(&t,buf);
char *pend = pbeg ? (pbeg+strlen(pbeg)) : pbeg;
if (pbeg >= pend) {
ods_log_error("[%s] time_datestamp: ctime_r() failed",
module_str);
return NULL;
}
/* strip trailing space characters including '\n' from time string */
for (p=pend-1; p>=pbeg && isspace(*p); --p) {
*p = '\0';
}
}
return buf;
#endif
}
const char *ods_check_command(const char *cmd, int cmdsize, const char *scmd)
{
size_t ncmd = strlen(scmd);
if (cmdsize < (int)ncmd || strncmp(cmd, scmd, ncmd) != 0) return 0;
if (cmd[ncmd] == '\0') {
cmd = "";
} else if (cmd[ncmd] != ' ') {
return NULL;
} else {
cmd = &cmd[ncmd+1];
}
return cmd;
}
int ods_find_arg(int *pargc, const char *argv[],
const char *longname, const char *shortname)
{
int i;
for (i=0; i<*pargc; ++i) {
const char *a = argv[i];
if (a[0] == '-') {
/* we found an option, now try to match it */
int bmatch = 0;
if (a[1] == '-')
bmatch = strcmp(&a[2],longname)==0; /* longopt */
else
bmatch = strcmp(&a[1],shortname)==0; /* shortopt */
if (bmatch) {
int j;
/* remove matching option from argv */
--(*pargc);
for (j=i; j<*pargc; ++j)
argv[j] = argv[j+1];
return i;
}
}
}
return -1;
}
int ods_find_arg_and_param(int *pargc, const char *argv[],
const char *longname, const char *shortname,
const char **pvalue)
{
int j;
const char *a;
int i = ods_find_arg(pargc,argv,longname,shortname);
if (i<0)
return i;
a = argv[i];
/* check that the argv entry is not an option itself. */
if (a[0] == '-') {
*pvalue = NULL;
return i;
}
/* set the value to the argv */
*pvalue = a;
/* remove parameter from argv */
--(*pargc);
for (j=i; j<*pargc; ++j)
argv[j] = argv[j+1];
return i;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.