本文整理汇总了C++中output_data函数的典型用法代码示例。如果您正苦于以下问题:C++ output_data函数的具体用法?C++ output_data怎么用?C++ output_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了output_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char const *argv[])
{
float x0 = -1.;
float x_max = 10.;
float dx = 0.05;
size_t x_size;
float* x_all = create_range(x0, x_max, dx, &x_size);
float t0 = 0.;
float t_max = 10.;
float dt = 0.02;
int plot_count = 10;
int plot_every = (int) t_max / dt / plot_count;
char *tag = "pure_1D";
char *dir = "pure_1D";
mkdir(dir);
float* phi = create_empty_array(x_size);
init_phi_1D(phi, x_all, x_size);
float mu = dt * M / (dx * dx);
float t = t0;
int i = 0;
while (t < t_max) {
if (i % plot_every == 0) {
output_data(x_all, phi, x_size, t, dir, tag);
}
i++;
t += dt;
update_phi(x_all, phi, x_size, t, mu, eps2, u_iso);
}
}
示例2: convert_UnicodetoANSI
static void* convert_UnicodetoANSI (const ustring::awareness_t* dest, const ustring::awareness_t* src, const void* p, void* result)
{
// convert from 16-bit to 8-bit characters
const int len= src->length(p);
const int hopefully_enough_slack= 100;
// A known problem. Sometimes WideCharToMultiByte can require a larger
// buffer when working than it does when finished. How big is unknown.
// It appears to only be a problem when composite characters are near the
// end of the input.
const int destsize= Unicode_converted_length (dest, src, p);
result= dest->create (destsize, result); //create or re-allocate as needed
// prepare output area
fastbuf<char, 1024> output_data (destsize+hopefully_enough_slack);
// do the actual converting
int srcpos= 0; // position of this gulp
int destpos= 0;
while (srcpos < len) { //still stuff left to process
// read input data
int srccount= len-srcpos; // number of input bytes to process in one gulp
const wchar_t* input_data= static_cast<const wchar_t*>(src->read_data(p,srcpos,srccount));
//note: call to read_data will reduce value of srccount if it can't get it all at once.
srcpos += srccount;
// convert this gulp
int putlen= ratwin::WideCharToMultiByte (input_data, srccount, output_data, output_data.elcount());
if (putlen == 0) {
win_exception X ("Classics", FNAME, __LINE__);
X += L"error calling WideCharToMultiByte\n";
throw X;
}
dest->write_data (result, destpos, putlen, output_data);
destpos += putlen;
}
return result;
}
示例3: convert_ANSItoUnicode
static void* convert_ANSItoUnicode (const ustring::awareness_t* dest, const ustring::awareness_t* src, const void* p, void* result)
{
// convert from 8-bit to 16-bit characters
const int len= src->length(p); //total number of BYTES to be converted
const int destsize= ANSI_converted_length (dest, src, p);
result= dest->create (destsize, result); //create or re-allocate as needed
// prepare output area
fastbuf<wchar_t, 1024> output_data (destsize);
// do the actual converting
int srcpos= 0; // position of this gulp
int destpos= 0;
while (srcpos < len) { //still stuff left to process
// read input data
int srccount= len-srcpos; // number of input bytes to process in one gulp
const char* input_data= static_cast<const char*>(src->read_data(p,srcpos,srccount));
//note: call to read_data will reduce value of srccount if it can't get it all at once.
srcpos += srccount;
// convert this gulp
int putlen= ratwin::MultiByteToWideChar (input_data, srccount, output_data, destsize);
if (putlen == 0) {
win_exception X ("Classics", FNAME, __LINE__);
X += L"error calling MultiByteToWideChar\n";
throw X;
}
dest->write_data (result, destpos, putlen, output_data);
destpos += putlen;
}
return result;
}
示例4: ISR_Timer_B_CCR0
__interrupt void ISR_Timer_B_CCR0 (void) {
// Feststellen welche Werte im timestruct der aktuellen Zeit
// geaendert werden muessen
if (now.s==10) { // eine Sekunde ist vergangen
now.s=0;
now.ss++;
// im Sekundentakt Uhrzeit und Werte des SHT11 ausgeben
output_data();
if (now.ss==60) { // eine Minute ist vergangen
now.ss=0;
now.mm++;
if (now.mm==60) { // eine Stunde ist vergangen
now.mm=0;
now.hh++;
if(now.hh==24) { // ein Tag ist vergangen
now.hh=0;
}
}
}
}
else { // eine Zentelsekunde ist Vergangen
now.s++;
}
// Interruptflag entfernen um eine Wiederholung der ISR, wegen
// gesetzem Interruptflag, zu verhindern
TBCCTL0 &= ~CCIFG;
}
示例5: use_temper1
static int use_temper1(struct usb_dev_handle *handle)
{
int r, do_read = TRUE;
char data[8];
char busport[100] = {};
r = handle_bus_port(handle, busport);
if (strlen(opts.only_device) > 0) {
do_read = (strcmp(busport, opts.only_device) == 0);
}
if (do_read) {
bzero(data, 8);
r = read_temper1(handle, data, 8);
if (r != 0) {
if (decode_raw_data(data) != 0) {
output_data(busport, data);
}
else {
if (opts.verbose) fprintf(stderr, "Read returned 0 value (r = %i)\n", r);
r = -1;
}
}
else {
if (opts.verbose) fprintf(stderr, "use_temper1: read_temper1 returned (r = %i)\n", r);
}
}
return r;
}
示例6: get_lifetime
int get_lifetime(int argc, char **argv)
{
int ret;
uint32_t timestamp;
uint8_t nonce[TOKEN_NONCE_LENGTH];
uint8_t mac[TOKEN_MAC_LENGTH];
ret = tee_token_lifetimedata_get(×tamp, nonce, mac);
if (ret != 0)
{
raise_error("tee_token_lifetimedata_get call failed, return=0x%x", ret);
return ret;
}
output_data((uint8_t *)×tamp, sizeof(timestamp));
output_data(nonce, sizeof(nonce));
output_data(mac, sizeof(mac));
return ret;
}
示例7: flowstat
/*
* flowstat
*
* Check for changes to flow control
*/
void
flowstat(void)
{
if (his_state_is_will(TELOPT_LFLOW)) {
if (tty_flowmode() != flowmode) {
flowmode = tty_flowmode();
output_data("%c%c%c%c%c%c",
IAC, SB, TELOPT_LFLOW,
flowmode ? LFLOW_ON : LFLOW_OFF,
IAC, SE);
}
if (tty_restartany() != restartany) {
restartany = tty_restartany();
output_data("%c%c%c%c%c%c",
IAC, SB, TELOPT_LFLOW,
restartany ? LFLOW_RESTART_ANY
: LFLOW_RESTART_XON,
IAC, SE);
}
}
}
示例8: main
int main(int argc, const char *argv[]) {
// Allocate flList
printf("-------- Allocating (list - length 4)\n");
flList *list = flList_alloc(4);
output_data(list);
// Populate flList
printf("-------- Populating\n");
int i = 100;
flList_set(list, 0, &i);
flList_set(list, 1, &(int){ 200 });
示例9: get_part_id
int get_part_id (int argc, char **argv)
{
int ret;
uint8_t partid_buf[TOKEN_PSID_LENGTH];
ret = tee_partid_get(partid_buf);
if (ret != 0)
raise_error("tee_partid_get() call failed, return=0x%x", ret);
else
output_data(partid_buf, sizeof(partid_buf));
return ret;
}
示例10: process_image
void process_image(const void *p, int size) {
byte *jpg = NULL;
unsigned int jpgSize = 0;
jpg = mjpeg2jpeg((const byte*)p, size, &jpgSize);
if ( jpg == NULL )
errno_exit("mjpeg2jpeg");
fprintf(stderr, "process_image %d\n", jpgSize);
output_data(jpg, jpgSize);
free(jpg);
}
示例11: get_ssn
int get_ssn(int argc, char **argv)
{
int ret;
uint8_t data[ssn_item.size];
ret = tee_token_item_read(SERIAL_NUMBER_DATAGROUP, ssn_item.subgroup_id,
ssn_item.item_id, 0, data, ssn_item.size, 0);
if (ret != 0)
raise_error("tee_token_item_read() call failed, return=0x%x", ret);
else
output_data(data, ssn_item.size);
return ret;
}
示例12: image_fireflies_filter
ImageRawData image_fireflies_filter ( ImageRawData * image_array, size_t array_num )
{
size_t width = image_array[ 0 ].GetImageWidth();
size_t height = image_array[ 0 ].GetImageHeight();
ImageRawData average_data( width, height );
ImageRawData output_data( width, height );
// for (int i = 0; i < width; i++)
// {
// for (int j = 0; j < height; j++)
// {
// for (int k = 0; k < array_num; k++)
// average_data.rawData[ i ][ j ] +=
// image_array[ k ].rawData[ i ][ j ] / array_num;
// }
// }
//
// double * weight;
//
// weight = static_cast<double * >( malloc ( sizeof ( double ) * array_num ) );
// for (int i = 0; i < width; i++)
// {
// for (int j = 0; j < height; j++)
// {
// double total = 0;
// for (int k = 0; k < array_num; k++)
// {
// weight[ i ] = ( average_data.rawData[ i ][ j ] - image_array[ k ].rawData[ i ][ j ] ).Length ();
// total += weight[ i ];
// }
//
// for (int k = 0; k < array_num; k++)
// {
// weight[ i ] /= total;
// // output_data.rawData[ i ][ j ] +=
// // image_array[ k ].rawData[ i ][ j ] * weight[ i ];
// output_data.rawData[ i ][ j ] +=
// image_array[ k ].rawData[ i ][ j ].Length() > average_data.rawData[ i ][ j ].Length()
// ? average_data.rawData[ i ][ j ]
// : image_array[ k ].rawData[ i ][ j ];
// }
// }
// }
return output_data;
}
示例13: input_data
void ReLULayer::forward(std::vector<Tensor> &input, std::vector<Tensor> &output) {
Tensor input_data(input[0]);
Tensor output_data(output[0]);
float* input_data_ptr = input_data.get_data().get();
float* output_data_ptr = output_data.get_data().get();
int N_in = input_data.get_N();
int C_in = input_data.get_C();
int H_in = input_data.get_H();
int W_in = input_data.get_W();
int data_size = N_in * C_in * H_in * W_in;
for(int index = 0; index < data_size; ++index) {
output_data_ptr[index] = input_data_ptr[index] > 0 ? input_data_ptr[index] : 0;
}
}
示例14: read_token
int read_token(int argc, char **argv)
{
uint8_t *buf;
int ret, datagroup_id;
struct tee_token_info info;
if (argc != 2)
{
raise_error("datagroup_id argument is missing");
return EXIT_FAILURE;
}
datagroup_id = parse_datagroup_id(argv[1]);
if (datagroup_id == -1)
return EXIT_FAILURE;
bzero(&info, sizeof(info));
ret = tee_token_info_get(datagroup_id, &info, 0);
if (ret != 0)
{
raise_error("tee_token_info_get() call failed, return=0x%x", ret);
return ret;
}
if (info.lifetime.token_size == 0)
{
raise_error("Failed, token has been provided with the old format...");
return EXIT_FAILURE;
}
buf = (uint8_t *)malloc(info.lifetime.token_size * sizeof(uint32_t));
if (buf == NULL)
{
raise_error("Failed to alloc the buffer to retrieve the token data, error=%s", strerror(ENOMEM));
return EXIT_FAILURE;
}
ret = tee_token_read(datagroup_id, buf, info.lifetime.token_size * sizeof(uint32_t), 0);
if (ret != 0)
raise_error("tee_token_read() call failed, return=0x%x", ret);
else
output_data(buf, info.lifetime.token_size * sizeof(uint32_t));
free(buf);
return EXIT_SUCCESS;
}
示例15: generate_shared_ecc
int generate_shared_ecc(int argc, char **argv)
{
int ret;
size_t pub_key_size;
uint8_t *pub_key = NULL;
ret = tee_token_gen_shared_ecc(&pub_key_size, &pub_key);
if (ret != 0)
raise_error("tee_token_gen_shared_ecc() call failed, return=0x%x", ret);
else {
output_data(pub_key, pub_key_size);
free(pub_key);
}
return ret;
}