hexsha
stringlengths
40
40
size
int64
22
2.4M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
260
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
260
max_issues_repo_name
stringlengths
5
109
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
260
max_forks_repo_name
stringlengths
5
109
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
22
2.4M
avg_line_length
float64
5
169k
max_line_length
int64
5
786k
alphanum_fraction
float64
0.06
0.95
matches
listlengths
1
11
7502e4d197ca799e0b7d387d30275d6d58638d25
5,254
c
C
lib/comgr/test/metadata_merge_test.c
haampie/ROCm-CompilerSupport
e07a251c203a4bac163058d36d781b075986ddd3
[ "NCSA" ]
null
null
null
lib/comgr/test/metadata_merge_test.c
haampie/ROCm-CompilerSupport
e07a251c203a4bac163058d36d781b075986ddd3
[ "NCSA" ]
null
null
null
lib/comgr/test/metadata_merge_test.c
haampie/ROCm-CompilerSupport
e07a251c203a4bac163058d36d781b075986ddd3
[ "NCSA" ]
null
null
null
#include "amd_comgr.h" #include "common.h" #include <stdio.h> #include <stdlib.h> #include <string.h> void metadata_test1(void); typedef struct test_meta_data_s { char *buf; amd_comgr_data_t data; amd_comgr_metadata_node_t root; } test_meta_data_t; void read_metadata(test_meta_data_t *meta_data, const char *file, bool error_expected, bool display) { long size; amd_comgr_status_t status; amd_comgr_metadata_kind_t mkind = AMD_COMGR_METADATA_KIND_NULL; // Read input file char buffer[1024]; snprintf(buffer, 1024, "%s/%s", TEST_OBJ_DIR, file); size = setBuf(buffer, &meta_data->buf); status = amd_comgr_create_data(AMD_COMGR_DATA_KIND_RELOCATABLE, &meta_data->data); checkError(status, "amd_comgr_create_data"); status = amd_comgr_set_data(meta_data->data, size, meta_data->buf); checkError(status, "amd_comgr_set_data"); status = amd_comgr_set_data_name(meta_data->data, NULL); checkError(status, "amd_comgr_set_data_name"); // Get metadata from data object if (display) printf("Get metadata from %s\n", file); status = amd_comgr_get_data_metadata(meta_data->data, &meta_data->root); if (!error_expected && status) { printf("Unexpected error from amd_comgr_get_data_metadata\n"); exit(1); } else { return; } checkError(status, "amd_comgr_get_data_metadata"); // the root must be map status = amd_comgr_get_metadata_kind(meta_data->root, &mkind); checkError(status, "amd_comgr_get_metadata_kind"); if (mkind != AMD_COMGR_METADATA_KIND_MAP) { printf("Root is not map\n"); exit(1); } if (display) { // print code object metadata int indent = 0; printf("Metadata for file %s : start\n", file); status = amd_comgr_iterate_map_metadata(meta_data->root, printEntry, (void *)&indent); checkError(status, "amd_comgr_iterate_map_metadata"); printf("Metadata for file %s : end\n\n", file); } } void lookup_meta_data(test_meta_data_t *meta_data, const char *key, amd_comgr_metadata_kind_t kind, void *data, bool error_expected) { amd_comgr_status_t status; amd_comgr_metadata_node_t lookup_node; amd_comgr_metadata_kind_t lookup_kind; status = amd_comgr_metadata_lookup(meta_data->root, key, &lookup_node); checkError(status, "amd_comgr_metadata_lookup"); status = amd_comgr_get_metadata_kind(lookup_node, &lookup_kind); if (!error_expected && status) { printf("Unexpected error from amd_comgr_get_metadata_kind\n"); exit(1); } else { status = amd_comgr_destroy_metadata(lookup_node); checkError(status, "amd_comgr_destroy_metadata"); return; } checkError(status, "amd_comgr_get_metadata_kind"); if (lookup_kind != kind) { printf("Metadata kind mismatch in lookup\n"); exit(1); } switch (kind) { case AMD_COMGR_METADATA_KIND_LIST: { size_t size = 0; size_t nentries = *((size_t *)data); status = amd_comgr_get_metadata_list_size(lookup_node, &size); checkError(status, "amd_comgr_get_metadata_list_size"); if (size != nentries) { printf("List node size mismatch : expected %zu got %zu\n", nentries, size); exit(1); } } break; default: printf("Unknown kind\n"); exit(1); } status = amd_comgr_destroy_metadata(lookup_node); checkError(status, "amd_comgr_destroy_metadata"); } void close_meta_data(test_meta_data_t *meta_data) { amd_comgr_status_t status; status = amd_comgr_destroy_metadata(meta_data->root); checkError(status, "amd_comgr_destroy_metadata"); status = amd_comgr_release_data(meta_data->data); checkError(status, "amd_comgr_release_data"); free(meta_data->buf); memset(meta_data, 0, sizeof(test_meta_data_t)); } int main(int argc, char *argv[]) { test_meta_data_t meta_data; memset(&meta_data, 0, sizeof(test_meta_data_t)); #define READ_METADATA(meta, file, is_error, display) do { \ read_metadata(&meta, file, is_error, display); \ close_meta_data(&meta); \ }while(0) #define LOOKUP_LIST_METADATA(meta, file, key, size, is_error) do { \ size_t n = size; \ read_metadata(&meta, file, is_error, false); \ lookup_meta_data(&meta, key, AMD_COMGR_METADATA_KIND_LIST, &n, is_error); \ close_meta_data(&meta); \ }while(0) READ_METADATA(meta_data, "source1-v2.o", false, true); READ_METADATA(meta_data, "source2-v2.o", false, true); READ_METADATA(meta_data, "source1-v3.o", false, true); READ_METADATA(meta_data, "source2-v3.o", false, true); READ_METADATA(meta_data, "shared12-v2.so", true, true); LOOKUP_LIST_METADATA(meta_data, "shared12-v3.so", "amdhsa.printf", 1, false); LOOKUP_LIST_METADATA(meta_data, "shared12-v3.so", "amdhsa.kernels", 2, false); LOOKUP_LIST_METADATA(meta_data, "shared12-v3.so", "amdhsa.version", 2, false); LOOKUP_LIST_METADATA(meta_data, "shared14-v3.so", "amdhsa.version", 2, true); LOOKUP_LIST_METADATA(meta_data, "shared23-v3.so", "amdhsa.kernels", 2, true); printf("Metadata merge tests : passed\n"); return 0; }
31.650602
81
0.683099
[ "object" ]
75061936a44c2615fd17008238ad9ac140838bbb
2,595
h
C
Engine/Source/ThirdParty/GooglePlay/gpg-cpp-sdk.v2.3/gpg-cpp-sdk/android/include/gpg/endpoint_discovery_listener_helper.h
windystrife/UnrealEngine_NVIDIAGameWork
b50e6338a7c5b26374d66306ebc7807541ff815e
[ "MIT" ]
1
2022-01-29T18:36:12.000Z
2022-01-29T18:36:12.000Z
Engine/Source/ThirdParty/GooglePlay/gpg-cpp-sdk.v2.3/gpg-cpp-sdk/android/include/gpg/endpoint_discovery_listener_helper.h
windystrife/UnrealEngine_NVIDIAGameWork
b50e6338a7c5b26374d66306ebc7807541ff815e
[ "MIT" ]
null
null
null
Engine/Source/ThirdParty/GooglePlay/gpg-cpp-sdk.v2.3/gpg-cpp-sdk/android/include/gpg/endpoint_discovery_listener_helper.h
windystrife/UnrealEngine_NVIDIAGameWork
b50e6338a7c5b26374d66306ebc7807541ff815e
[ "MIT" ]
null
null
null
// Copyright 2017 Google Inc. All rights reserved. // These files are licensed under the Google Play Games Services Terms of // Service which can be found here: // https://developers.google.com/games/services/terms /** * @file gpg/endpoint_discovery_listener_helper.h * @brief Builds an interface for listening for nearby endpoints that have been * discovered. */ #ifndef GPG_ENDPOINT_DISCOVERY_LISTENER_HELPER_H_ #define GPG_ENDPOINT_DISCOVERY_LISTENER_HELPER_H_ #include <functional> #include <string> #include "gpg/common.h" #include "gpg/nearby_connection_types.h" namespace gpg { class EndpointDiscoveryListenerHelperImpl; /** * Defines a helper which can be used to provide IEndpointDiscoveryListener * callbacks to the SDK without defining the full IEndpointDiscoveryListener * interface. Callbacks configured on this object will be invoked * as described in the nearby connections API. Callbacks * not explicitly set will do nothing. */ class GPG_EXPORT EndpointDiscoveryListenerHelper { public: EndpointDiscoveryListenerHelper(); /** * Constructs a EndpointDiscoveryListenerHelper from a * <code>shared_ptr</code> to a * <code>EndpointDiscoveryListenerHelperImpl</code>. Intended for internal use * by the API. */ EndpointDiscoveryListenerHelper( std::shared_ptr<EndpointDiscoveryListenerHelperImpl> impl); /** * <code>OnEndpointFoundCallback</code> is called when a * remote endpoint is found. * <code>client_id</code> is the ID of the NearbyConnections instance that * discovered the endpoint. * <code>endpoint_details</code> contains the details of the discovered * remote endpoint. */ typedef std::function<void(int64_t client_id, EndpointDetails const &endpoint_details)> OnEndpointFoundCallback; /** * Set the OnEndpointFoundCallback. */ EndpointDiscoveryListenerHelper &SetOnEndpointFoundCallback( OnEndpointFoundCallback callback); /** * <code>OnEndpointLostCallback</code> is called when a * remote endpoint is no longer discoverable. */ typedef std::function<void(int64_t client_id, std::string const &remote_endpoint_id)> OnEndpointLostCallback; /** * Set the OnEndpointLostCallback. */ EndpointDiscoveryListenerHelper &SetOnEndpointLostCallback( OnEndpointLostCallback callback); private: friend class EndpointDiscoveryListenerHelperImpl; std::shared_ptr<EndpointDiscoveryListenerHelperImpl> impl_; }; } // namespace gpg #endif // GPG_ENDPOINT_DISCOVERY_LISTENER_HELPER_H_
30.174419
80
0.75106
[ "object" ]
7507c5a2b19a8781b78572419f68a03ea805d667
2,215
h
C
System/Library/Frameworks/ARKit.framework/AREnvironmentProbeManager.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
System/Library/Frameworks/ARKit.framework/AREnvironmentProbeManager.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
System/Library/Frameworks/ARKit.framework/AREnvironmentProbeManager.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
/* * This header is generated by classdump-dyld 1.5 * on Wednesday, October 27, 2021 at 3:16:36 PM Mountain Standard Time * Operating System: Version 13.5.1 (Build 17F80) * Image Source: /System/Library/Frameworks/ARKit.framework/ARKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ @protocol OS_dispatch_semaphore; #import <ARKit/ARKit-Structs.h> @class NSMutableArray, NSMutableDictionary, NSUUID, NSObject, AREnvironmentProbeUpdate, ARImageData, ARCubemapGenerator; @interface AREnvironmentProbeManager : NSObject { double _minimumProbeUpdateInterval; double _lastProbeUpdateTime; NSMutableArray* _initialProbeIdentifiers; NSMutableArray* _anchorsToRemove; NSMutableDictionary* _probesByIdentifier; NSMutableDictionary* _probeIdentifiersByPlaneIdentifier; NSMutableArray* _requestedProbeIdentifiers; NSMutableArray* _updatedProbeIdentifiers; NSMutableArray* _directTexturingIdentifiers; NSUUID* _universeProbeIdentifier; NSObject*<OS_dispatch_semaphore> _textureDataSemaphore; NSMutableArray* _probeUpdateQueue; AREnvironmentProbeUpdate* _currentProbeUpdate; NSObject*<OS_dispatch_semaphore> _semaphore; ARImageData* _lastImageData; SCD_Struct_AR1 _lastCameraTransform; vector<ARTexturedPlane, std::__1::allocator<ARTexturedPlane> >* _lastPlanes; ARCubemapGenerator* _cubemapGenerator; BOOL _isReady; long long _mode; } @property (nonatomic,readonly) long long mode; //@synthesize mode=_mode - In the implementation block -(long long)mode; -(BOOL)isBusy; -(id)initWithMode:(long long)arg1 ; -(id)_fullDescription; -(id)updateProbesForTimestamp:(double)arg1 planes:(vector<ARTexturedPlane, std::__1::allocator<ARTexturedPlane> >*)arg2 imageData:(id)arg3 pose:(id)arg4 enableDirectTexturingForProbesWithIdentifier:(id)arg5 ; -(BOOL)_textureDataIsBusy; -(void)insertIntoQueue:(id)arg1 ; -(void)requestTextureForProbe:(id)arg1 ; -(BOOL)addProbeWithAnchor:(id)arg1 timestamp:(double)arg2 textureImmediately:(BOOL)arg3 ; -(void)updateProbesFromExistingAnchors:(id)arg1 ; @end
42.596154
208
0.76298
[ "vector" ]
750bbcd8d677e34e6553865b1a65590a275f9960
109,862
c
C
src/test/resources/c-converted-action.c
Dynatrace/Dynatrace-LoadRunner-Request-Tagging
bb88f3ab561c05423abf13b05ba08185acd53073
[ "Apache-2.0" ]
4
2018-08-15T03:56:56.000Z
2019-09-06T13:36:52.000Z
src/test/resources/c-converted-action.c
Dynatrace/Dynatrace-LoadRunner-Request-Tagging
bb88f3ab561c05423abf13b05ba08185acd53073
[ "Apache-2.0" ]
7
2018-07-19T12:31:19.000Z
2019-03-05T09:46:03.000Z
src/test/resources/c-converted-action.c
Dynatrace/Dynatrace-LoadRunner-Request-Tagging
bb88f3ab561c05423abf13b05ba08185acd53073
[ "Apache-2.0" ]
6
2018-07-19T11:52:27.000Z
2019-02-11T13:13:44.000Z
Action() { web_add_cookie("rxVisitor=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q; DOMAIN=localhost"); web_add_cookie("dtPC=1$534276621_895h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536076750|1530534276697; DOMAIN=localhost"); web_add_cookie("dtSa=-; DOMAIN=localhost"); web_add_cookie("rxvt=1530536081459|1530534276697; DOMAIN=localhost"); // web_url("WRONG_PARAMETER", "URL=https://something.com/", "TargetFrame=", "Resource=0", "RecContentType=text/html"); lr_start_transaction("GlobalTransaction"); lr_start_transaction("InitialTransaction"); addDynatraceHeaderTest("TSN=GlobalTransaction - InitialTransaction;PC=localhost:8079;SI=LoadRunner;LSN=script name;"); web_url("localhost:8079", "URL=http://localhost:8079/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", EXTRARES, "Url=/img/journey_box.png", ENDITEM, "Url=/img/header.png", ENDITEM, "Url=https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.pl.de2wM28ILrc.O/m=plusone/rt=j/sv=1/d=1/ed=1/am=wQ/rs=AGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA/cb=gapi.loaded_0", ENDITEM, "Url=/img/gradient/Verlauf_Grau_Button_4.png", ENDITEM, "Url=/img/gradient/Verlauf_Orange_Button_4.png", ENDITEM, "Url=/img/gradient/Verlauf_Grau_Loginbox.png", ENDITEM, "Url=/img/searchbox.png", ENDITEM, "Url=/css/css-images/cal_button.gif", ENDITEM, "Url=/img/menupunkt_trennung_transparent.png", ENDITEM, "Url=/css/css-images/ajax-loader.gif", ENDITEM, "Url=/img/gradient/Verlauf_Orange_Hauptfeld.png", ENDITEM, "Url=/img/gradient/Verlauf_Orange_Button_1.png", ENDITEM, "Url=/img/gradient/Verlauf_Grau_ganzeBreite.png", ENDITEM, "Url=/img/gradient/Verlauf_Grau_Hauptfeld.png", ENDITEM, "Url=/img/login/Loginwindow_textbox.png", ENDITEM, "Url=/img/gradient/Verlauf_Grau_Button_3.png", ENDITEM, "Url=http://connect.facebook.net/en_US/all.js", ENDITEM, "Url=/img/menupunkt_auswahl_transparent.png", ENDITEM, "Url=/img/logo_layer_bottom.png", ENDITEM, "Url=/img/booking/Booking_transaction_textbox_medium1_page_3.png", ENDITEM, "Url=https://platform.linkedin.com/js/secureAnonymousFramework?v=1.0.328-1429&lang=en_US", ENDITEM, "Url=https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.pl.de2wM28ILrc.O/m=auth/exm=plusone/rt=j/sv=1/d=1/ed=1/am=wQ/rs=AGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA/cb=gapi.loaded_1", ENDITEM, "Url=http://assets.pinterest.com/js/pinit_main.js?0.47113422356133966", ENDITEM, "Url=http://localhost:8092/image/winter.jpeg", ENDITEM, "Url=https://platform.twitter.com/js/button.efa03583c158eb89fd00b8c75a70efae.js", ENDITEM, "Url=https://static.licdn.com/scds/common/u/images/apps/connect/sprites/sprite_connect_v14.png", ENDITEM, "Url=https://syndication.twitter.com/i/jot?l=" "%7B%22widget_origin%22%3A%22http%3A%2F%2Flocalhost%3A8079%2F%22%2C%22widget_frame%22%3Afalse%2C%22language%22%3A%22en%22%2C%22message%22%3A%22m%3Awithcount%3A%22%2C%22_category_%22%3A%22tfw_client_event%22%2C%22triggered_on%22%3A1530534286043%2C%22dnt%22%3Afalse%2C%22client_version%22%3A%22910cbce%3A1530167310832%22%2C%22format_version%22%3A1%2C%22event_namespace%22%3A%7B%22client%22%3A%22tfw%22%2C%22page%22%3A%22button%22%2C%22section%22%3A%22follow%22%2C%22action%22%3A%22impression%22%7D%7D", ENDITEM, "Url=/img/header2.jpg", ENDITEM, "Url=https://syndication.twitter.com/i/jot?l=" "%7B%22widget_origin%22%3A%22http%3A%2F%2Flocalhost%3A8079%2F%22%2C%22widget_frame%22%3Anull%2C%22duration_ms%22%3A19171.83664939617%2C%22_category_%22%3A%22tfw_client_event%22%2C%22triggered_on%22%3A1530534299194%2C%22dnt%22%3Afalse%2C%22client_version%22%3A%22910cbce%3A1530167310832%22%2C%22format_version%22%3A1%2C%22event_namespace%22%3A%7B%22client%22%3A%22tfw%22%2C%22action%22%3A%22render%22%2C%22page%22%3A%22page%22%2C%22component%22%3A%22performance%22%7D%7D", ENDITEM, LAST); web_set_sockets_option("SSL_VERSION", "2&3"); addDynatraceHeaderTest("TSN=GlobalTransaction - InitialTransaction;PC=xaOI6zd9HW9.js;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js", "URL=http://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t2.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("TSN=GlobalTransaction - InitialTransaction;PC=xaOI6zd9HW9.js_2;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_2", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t3.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("TSN=GlobalTransaction - InitialTransaction;PC=fastbutton;SI=LoadRunner;LSN=script name;"); web_url("fastbutton", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t4.inf", "Mode=HTML", LAST); web_add_header("Faces-Request", "partial/ajax"); addDynatraceHeaderTest("TSN=GlobalTransaction - InitialTransaction;PC=orange.jsf;jsessionid=72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280;SI=LoadRunner;LSN=script name;"); web_submit_data("orange.jsf;jsessionid=72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280", "Action=http://localhost:8079/orange.jsf;jsessionid=72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280", "Method=POST", "RecContentType=text/xml", "Referer=http://localhost:8079/", "Snapshot=t5.inf", "Mode=HTML", "EncodeAtSign=YES", ITEMDATA, "Name=loginForm", "Value=loginForm", ENDITEM, "Name=javax.faces.ViewState", "Value=-1088058446389217368:-4496397503878788666", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp71n", ENDITEM, "Name=loginForm:username", "Value=", ENDITEM, "Name=loginForm:password", "Value=", ENDITEM, "Name=icefacesCssUpdates", "Value=", ENDITEM, "Name=loginForm:j_idcl", "Value=loginForm:loginLink", ENDITEM, "Name=javax.faces.source", "Value=loginForm:loginLink", ENDITEM, "Name=javax.faces.partial.event", "Value=click", ENDITEM, "Name=javax.faces.partial.execute", "Value=@all", ENDITEM, "Name=javax.faces.partial.render", "Value=@all", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp71n", ENDITEM, "Name=ice.focus", "Value=loginForm:loginLink", ENDITEM, "Name=loginForm:loginLink", "Value=loginForm:loginLink", ENDITEM, "Name=ice.event.target", "Value=loginForm:loginLink", ENDITEM, "Name=ice.event.captured", "Value=loginForm:loginLink", ENDITEM, "Name=ice.event.type", "Value=onclick", ENDITEM, "Name=ice.event.alt", "Value=false", ENDITEM, "Name=ice.event.ctrl", "Value=false", ENDITEM, "Name=ice.event.shift", "Value=false", ENDITEM, "Name=ice.event.meta", "Value=false", ENDITEM, "Name=ice.event.x", "Value=1358", ENDITEM, "Name=ice.event.y", "Value=43", ENDITEM, "Name=ice.event.left", "Value=true", ENDITEM, "Name=ice.event.right", "Value=false", ENDITEM, "Name=ice.submit.type", "Value=ice.s", ENDITEM, "Name=ice.submit.serialization", "Value=form", ENDITEM, "Name=javax.faces.partial.ajax", "Value=true", ENDITEM, LAST); lr_end_transaction("InitialTransaction", 2); addDynatraceHeaderTest("TSN=GlobalTransaction;PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t6.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("TSN=GlobalTransaction;PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t7.inf", "Mode=HTML", EXTRARES, "Url=https://cdn.syndication.twimg.com/widgets/followbutton/info.json?callback=__twttr.setFollowersCountAndFollowing&lang=en&screen_names=dynatrace", ENDITEM, LAST); web_add_cookie("rxvt=1530536086774|1530534276697; DOMAIN=localhost"); addDynatraceHeaderTest("TSN=GlobalTransaction;PC=rb_1;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2F&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/", "Snapshot=t8.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=" "1%7C1%7C_load_%7C_load_%7C-%7C1530534276368%7C0%7C329%2C2%7C2%7CUnable%20to%20get%20property%20%27configuration%27%20of%20undefined%20or%20null%20reference%7C_error_%7C-%7C1530534281458%7C1530534281458%7C-1%2C3%7C3%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%5Ep42%5Ep13%7C_location_%7C-%7C1530534281459%7C1530534281459%7C-1%2C3%7C4%7CTypeError%3A%20Unable%20to%20get%20property%20%27configura" "tion%27%20of%20undefined%20or%20null%20reference%5Ep%20%20%20at%20configurationOf%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A42%3A13%29%5Ep%20%20%20at%20viewIDOf%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A51%3A13%29%5Ep%20%20%20at%20fullSubmit%20%28http%3A%2F%2Flocalhost%" "3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A1928%3A13%29%5Ep%20%20%20at%20submit%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A1986%3A9%29%5Ep%20%20%20at%20aw%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fcompat.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3A1%3A15" "331%29%5Ep%20%20%20at%20onclick%20%28http%3A%2F%2Flocalhost%3A8079%2F%3A64%3A213%29%7C_stack_%7C-%7C1530534281460%7C1530534281460%7C-1%2C3%7C5%7C4837%7C_ts_%7C-%7C1530534281461%7C1530534281461%7C-1%2C3%7C6%7CC%5EpLogin%7C_useraction_%7C-%7C1530534281461%7C1530534281461%7C-1$PV=1$rId=RID_2418$rpId=1914199235$url=http%3A%2F%2Flocalhost%3A8079%2F$title=easyTravel%20-%20One%20step%20to%20happiness$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534276621_895$v=10150180628221724$time=1530534286774", LAST); addDynatraceHeaderTest("TSN=GlobalTransaction;PC=like.php;SI=LoadRunner;LSN=script name;"); web_url("like.php", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df190f22b0574fe9%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ffa68c3fb208807%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t9.inf", "Mode=HTML", LAST); lr_end_transaction("GlobalTransaction", 2); /*Possible OAUTH authorization was detected. It is recommended to correlate the authorization parameters.*/ addDynatraceHeaderTest("PC=postmessageRelay;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t10.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=log.pinterest.com;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com", "URL=https://log.pinterest.com/?guid=9HPC4azgtdJ1&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2F&callback=PIN_1530534283557.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/", "Snapshot=t11.inf", "Mode=HTML", EXTRARES, "Url=https://static.xx.fbcdn.net/rsrc.php/v3iEpO4/yY/l/en_US/qpR8vvH3FBB.js", "Referer=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df190f22b0574fe9%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ffa68c3fb208807%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&" "show_faces=false&width=300", ENDITEM, "Url=https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.pl.de2wM28ILrc.O/m=rpc,shindig_random/rt=j/sv=1/d=1/ed=1/am=wQ/rs=AGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA/cb=gapi.loaded_0", "Referer=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", ENDITEM, LAST); web_add_header("Origin", "https://platform.twitter.com"); addDynatraceHeaderTest("PC=settings;SI=LoadRunner;LSN=script name;"); web_url("settings", "URL=https://syndication.twitter.com/settings", "Resource=0", "RecContentType=application/json", "Referer=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Snapshot=t12.inf", "Mode=HTML", LAST); web_add_header("Faces-Request", "partial/ajax"); addDynatraceHeaderTest("PC=orange.jsf;SI=LoadRunner;LSN=script name;"); web_submit_data("orange.jsf", "Action=http://localhost:8079/orange.jsf", "Method=POST", "RecContentType=text/xml", "Referer=http://localhost:8079/", "Snapshot=t13.inf", "Mode=HTML", "EncodeAtSign=YES", ITEMDATA, "Name=loginForm", "Value=loginForm", ENDITEM, "Name=javax.faces.ViewState", "Value=-1088058446389217368:-4496397503878788666", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp71n", ENDITEM, "Name=loginForm:username", "Value=labuser", ENDITEM, "Name=loginForm:password", "Value=labpass", ENDITEM, "Name=icefacesCssUpdates", "Value=", ENDITEM, "Name=loginForm:j_idcl", "Value=", ENDITEM, "Name=javax.faces.source", "Value=loginForm:password", ENDITEM, "Name=javax.faces.partial.event", "Value=keypress", ENDITEM, "Name=javax.faces.partial.execute", "Value=@all", ENDITEM, "Name=javax.faces.partial.render", "Value=@all", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp71n", ENDITEM, "Name=ice.focus", "Value=loginForm:password", ENDITEM, "Name=ice.event.target", "Value=loginForm:password", ENDITEM, "Name=ice.event.captured", "Value=loginForm:password", ENDITEM, "Name=ice.event.type", "Value=onkeypress", ENDITEM, "Name=ice.event.alt", "Value=false", ENDITEM, "Name=ice.event.ctrl", "Value=false", ENDITEM, "Name=ice.event.shift", "Value=false", ENDITEM, "Name=ice.event.meta", "Value=false", ENDITEM, "Name=ice.event.keycode", "Value=13", ENDITEM, "Name=ice.submit.type", "Value=ice.s", ENDITEM, "Name=ice.submit.serialization", "Value=form", ENDITEM, "Name=javax.faces.partial.ajax", "Value=true", ENDITEM, LAST); web_add_cookie("rxvt=1530536095351|1530534276697; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_2;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_2", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2F&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/", "Snapshot=t14.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=1%7C7%7Crx_visittag%3Dlabuser%7C_rs_%7C-%7C1530534295347%7C1530534295347%7C331$rId=RID_2418$rpId=1914199235$domR=1530534282880$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2F$title=easyTravel%20-%20One%20step%20to%20happiness$vd=8576$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534276621_895$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$nV=1$nVAT=1$time=1530534295351", EXTRARES, "Url=/img/favicon_orange_plane.ico", "Referer=", ENDITEM, LAST); web_add_cookie("dtPC=1$534276621_895h8vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536099060|1530534276697; DOMAIN=localhost"); web_add_cookie("dtCookie=1$90732712A19CFE460D187D5D153DF84F|RUM+Default+Application|1; DOMAIN=localhost"); web_add_auto_header("X-Requested-With", "XMLHttpRequest"); addDynatraceHeaderTest("PC=CalculateRecommendations;SI=LoadRunner;LSN=script name;"); web_custom_request("CalculateRecommendations", "URL=http://localhost:8079/CalculateRecommendations?_=1530534300070", "Method=GET", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t15.inf", "Mode=HTML", "EncType=application/x-www-form-urlencoded; charset=UTF-8", LAST); web_revert_auto_header("X-Requested-With"); addDynatraceHeaderTest("PC=CalculateRecommendations_2;SI=LoadRunner;LSN=script name;"); web_custom_request("CalculateRecommendations_2", "URL=http://localhost:8079/CalculateRecommendations?_=1530534300072", "Method=GET", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t16.inf", "Mode=HTML", "EncType=application/x-www-form-urlencoded; charset=UTF-8", LAST); web_add_cookie("rxvt=1530536101888|1530534276697; DOMAIN=localhost"); web_add_cookie("dtSa=true%7CC%7C-1%7CBook%20Now%7C-%7C1530534301830%7C534276621_895%7Chttp%3A%2F%2Flocalhost%3A8079%2F%7CeasyTravel%20-%20One%20step%20to%20happiness%7C1530534295353%7C; DOMAIN=localhost"); addDynatraceHeaderTest("PC=BookNow;SI=LoadRunner;LSN=script name;"); web_link("Book Now", "Text=Book Now", "Ordinal=1", "Snapshot=t17.inf", LAST); web_add_cookie("dtPC=1$534302214_201h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536102217|1530534276697; DOMAIN=localhost"); web_add_cookie("dtLatC=37; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_3;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_3", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2F&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/", "Snapshot=t18.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=" "1%7C1%7C_load_%7C_load_%7C-%7C1530534276368%7C0%7C329%2C2%7C2%7CUnable%20to%20get%20property%20%27configuration%27%20of%20undefined%20or%20null%20reference%7C_error_%7C-%7C1530534281458%7C1530534281461%7C-1%2C3%7C3%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%5Ep42%5Ep13%7C_location_%7C-%7C1530534281459%7C1530534281459%7C-1%2C3%7C4%7CTypeError%3A%20Unable%20to%20get%20property%20%27configura" "tion%27%20of%20undefined%20or%20null%20reference%5Ep%20%20%20at%20configurationOf%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A42%3A13%29%5Ep%20%20%20at%20viewIDOf%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A51%3A13%29%5Ep%20%20%20at%20fullSubmit%20%28http%3A%2F%2Flocalhost%" "3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A1928%3A13%29%5Ep%20%20%20at%20submit%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3Frand%3D963083509%3A1986%3A9%29%5Ep%20%20%20at%20aw%20%28http%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fcompat.js.jsf%5Esjsessionid%3D72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280%3A1%3A15" "331%29%5Ep%20%20%20at%20onclick%20%28http%3A%2F%2Flocalhost%3A8079%2F%3A64%3A213%29%7C_stack_%7C-%7C1530534281460%7C1530534281460%7C-1%2C3%7C5%7C4837%7C_ts_%7C-%7C1530534281461%7C1530534281461%7C-1%2C3%7C6%7CC%5EpLogin%7C_useraction_%7C-%7C1530534281461%7C1530534281461%7C-1%2C2%7C8%7C_onload_%7C_load_%7C-%7C1530534299060%7C0%7C329$rId=RID_2418$rpId=1914199235$domR=1530534299059$w=1920$h=1082$sw=1920$sh=1200$nt=a0b1530534276368e0f0g0h0i0k0l0m58n0o6512p6512q6635r22691s22693t22693$V=22560|c$S=" "9322$url=http%3A%2F%2Flocalhost%3A8079%2F$title=easyTravel%20-%20One%20step%20to%20happiness$isUnload=true$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534276621_895$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$nV=1$time=1530534301888", EXTRARES, "Url=/img/booking/stepindicator.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/Slider_empty_shadow.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_1_inactive.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_2_active.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_3_inactive.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_4_inactive.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, "Url=/img/gradient/Verlauf_Grau_Button_1.png", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_2;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_2", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t19.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_2;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_2", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t20.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_2;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_2", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t21.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.14202571753375087", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_3;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_3", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t22.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_2;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_2", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t23.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_2;SI=LoadRunner;LSN=script name;"); web_url("like.php_2", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df316dfbb4fc305%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ffcc19db8c7ed06%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t24.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=jot;SI=LoadRunner;LSN=script name;"); web_submit_data("jot", "Action=https://syndication.twitter.com/i/jot", "Method=POST", "RecContentType=text/html", "Referer=", "Snapshot=t25.inf", "Mode=HTML", ITEMDATA, "Name=dnt", "Value=0", ENDITEM, "Name=tfw_redirect", "Value=https://platform.twitter.com/jot.html", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-review.jsf?journeyId=9449\",\"widget_frame\":false,\"language\":\"en\",\"message\":\"m:withcount:\",\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534303102,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"page\":\"button\",\"section\":\"follow\",\"action\":\"impression\"}}", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-review.jsf?journeyId=9449\",\"widget_frame\":null,\"duration_ms\":396.67223849993274,\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534303102,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"action\":\"render\",\"page\":\"page\",\"component\":\"performance\"}}", ENDITEM, LAST); addDynatraceHeaderTest("PC=log.pinterest.com_2;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com_2", "URL=https://log.pinterest.com/?guid=iW6oinQMeQzY&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-review.jsf%3FjourneyId%3D9449&callback=PIN_1530534302668.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t26.inf", "Mode=HTML", LAST); web_add_cookie("rxvt=1530536105105|1530534276697; DOMAIN=localhost"); web_add_cookie("dtSa=true%7CC%7C-1%7CNext%7C-%7C1530534305045%7C534302214_201%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-review.jsf%3FjourneyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Your%20Journey%7C1530534295353%7C; DOMAIN=localhost"); addDynatraceHeaderTest("PC=orange-booking-payment.jsf;SI=LoadRunner;LSN=script name;"); web_url("orange-booking-payment.jsf", "URL=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t27.inf", "Mode=HTML", LAST); web_add_cookie("dtPC=1$534305430_219h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536105433|1530534276697; DOMAIN=localhost"); web_add_cookie("dtLatC=39; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_4;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_4", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-review.jsf%3FjourneyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-review.jsf?journeyId=9449", "Snapshot=t28.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=d%7C-1%7CBook%20Now%7CC%7C-%7C534276621_895%7C1530534301830%7Chttp%3A%2F%2Flocalhost%3A8079%2F%7CeasyTravel%20-%20One%20step%20to%20happiness%2C1%7C1%7C_load_%7C_load_%7C-%7C1530534301893%7C0%7C286%7C-%7C-%7C-%7C-%7C-%7Chttp%3A%2F%2Flocalhost%3A8079%2F%2C2%7C2%7C_onload_%7C_load_%7C-%7C1530534303281%7C1530534303283%7C286$rId=RID_876237400$rpId=-195975343$domR=1530534303280$w=1920$h=1082$sw=1920$sh=1200$nt=a0b1530534301893e39f39g39h39i39k75l79m83n79o492p492q562r1387s1388t1390$V=1022|c$S=" "463$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-review.jsf%3FjourneyId%3D9449$title=easyTravel%20-%20Booking%20-%20Your%20Journey$vd=9750$isUnload=true$latC=37$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534302214_201$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534305105", EXTRARES, "Url=/img/booking/Booking_transaction_textbox_large_page_3.png", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_3_active.png", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_2_inactive.png", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/Booking_transaction_textbox_small_page_3.png", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/Booking_transaction_textbox_medium2_page_3.png", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_3;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_3", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t29.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_3;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_3", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t30.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_3;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_3", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t31.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.17254513468103805", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_3;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_3", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t32.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_4;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_4", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t33.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_3;SI=LoadRunner;LSN=script name;"); web_url("like.php_3", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df1715feb5ee6ba%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ff3ac65e10671c38%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t34.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=log.pinterest.com_3;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com_3", "URL=https://log.pinterest.com/?guid=oT55CHQX324F&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449&callback=PIN_1530534305917.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t35.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=jot_2;SI=LoadRunner;LSN=script name;"); web_submit_data("jot_2", "Action=https://syndication.twitter.com/i/jot", "Method=POST", "RecContentType=text/html", "Referer=", "Snapshot=t36.inf", "Mode=HTML", ITEMDATA, "Name=dnt", "Value=0", ENDITEM, "Name=tfw_redirect", "Value=https://platform.twitter.com/jot.html", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-payment.jsf?journeyId=9449\",\"widget_frame\":false,\"language\":\"en\",\"message\":\"m:withcount:\",\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534306731,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"page\":\"button\",\"section\":\"follow\",\"action\":\"impression\"}}", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-payment.jsf?journeyId=9449\",\"widget_frame\":null,\"duration_ms\":773.5584342568816,\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534306731,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"action\":\"render\",\"page\":\"page\",\"component\":\"performance\"}}", ENDITEM, LAST); web_add_cookie("rxvt=1530536108515|1530534276697; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_5;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_5", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t37.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=d%7C-1%7CNext%7CC%7C-%7C534302214_201%7C1530534305045%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-review.jsf%3FjourneyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Your%20Journey%2C1%7C1%7C_load_%7C_load_%7C-%7C1530534305110%7C1530534306558%7C279%7C-%7C-%7C-%7C-%7C-%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-review.jsf%3FjourneyId%3D9449%2C2%7C2%7C_onload_%7C_load_%7C-%7C1530534306556%7C1530534306558%7C278$rId=RID_359402546$rpId=934729829$domR=1530534306555$w=1920$h=1082$sw=1920$sh" "=1200$nt=a0b1530534305110e50f50g50h50i50k78l81m84n81o501p501q565r1445s1446t1448$V=866|c$S=445$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449$title=easyTravel%20-%20Booking%20-%20Payment$vd=13161$latC=39$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534305430_219$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534308515", LAST); web_add_cookie("dtPC=1$534305430_219h-vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536110586|1530534276697; DOMAIN=localhost"); web_add_cookie("dtLatC=1; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_6;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_6", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t38.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$3p=" "1-1530534305110%3Blocalhost%7Cu%7C32%7C0%7C0%7C9%7C0%7C32%7C%7C0%7C0%7C0%7C101_212_428_428_499_545%7C8%7C0%7C111%7C13%7C0%7C0%7C13%7C0%7C13%7C%7C0%7C0%7C0%7C90_97_108_109%7C0%7C0%7C1%7C5%7C0%7C0%7C5%7C85_90%7C1%7C1%7C1%7C4%7C0%7C0%7C4%7C98_100%7C1%7C1%7C1%3Bapis.google.com%7Ck%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C97_98%7C1%7C1%7C1%7C3%7C0%7C0%7C1%7C370_372_541_545_561_798%7C80%7C1%7C237%3Bassets.dynatrace.com%7C2%7C1%7C0%7C0%7C0%7C0%7C1%7C%7C0%7C0%7C0%7C101_101%7C0%7C0%7C0%3Bplatform.twitter.c" "om%7Ck%7C2%7C0%7C0%7C2%7C0%7C2%7C%7C0%7C0%7C0%7C102_103_566_567%7C1%7C1%7C1%7C3%7C0%7C0%7C1%7C534_1050%7C184%7C0%7C320%3Bplatform.linkedin.com%7Ck%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C103_105%7C1%7C1%7C1%7C1%7C0%7C0%7C1%7C471_472%7C1%7C1%7C1%3Bassets.pinterest.com%7C6%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C105_107%7C2%7C2%7C2%7C2%7C0%7C0%7C1%7C0%7C2%7C%7C0%7C0%7C0%7C106_108_712_805%7C47%7C1%7C93%3Bconnect.facebook.net%7C4%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C425_426%7C1%7C1%7C1%3Bstatic." "licdn.com%7C2%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C501_501%7C0%7C0%7C0%3Baccounts.google.com%7Cg%7C1%7C0%7C0%7C0%7C590_806%7C216%7C216%7C216%3Bstaticxx.facebook.com%7C4%7C2%7C0%7C0%7C0%7C0%7C2%7C%7C0%7C0%7C0%7C678_1073%7C220%7C78%7C362%3Bwww.facebook.com%7Cg%7C2%7C0%7C0%7C1%7C858_1318%7C230%7C0%7C460%3Blog.pinterest.com%7Cg%7C1%7C0%7C0%7C0%7C1822_2008%7C186%7C186%7C186$rt=" "1-1530534305110%3Bhttp%3A%2F%2Flocalhost%3A8079%2Fcss%2FBaseProd.css%7Cb85e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Ffooter.css%7Cb86e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Frime.css%7Cb87e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Frating.css%7Cb88e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Forange.css%7Cb89e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery-1.8.1.js%7Cb90e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquer" "y-ui-1.8.2.min.js%7Cb90e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fversion.js%7Cb91e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FdtagentApi.js%7Cb92e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FFrameworkProd.js%7Cb93e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery.formLabels1.0.js%7Cb93e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FheaderRotation.js%7Cb94e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Frating.js%7Cb95e0f0g0h0i0k0l0m1%7C" "http%3A%2F%2Flocalhost%3A8079%2Fjs%2Frecommendation.js%7Cb96e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fproblempatterns%2Fchangedetectionlib.js%7Cb96e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fusertimings.js%7Cb97e0f0g0h0i0k0l0m1%7Chttps%3A%2F%2Fapis.google.com%2Fjs%2Fplusone.js%7Cb97e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fjsf.js.jsf%3Fln%3Djavax.faces%7Cb98e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%3" "Frand%3D963083509%7Cb99e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fcompat.js.jsf%7Cb99e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Ficefaces-compat.js.jsf%7Cb100e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fapple%2Fapple.png%7Cb101e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fandroidbutton.png%7Cb101e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Ffacebookbutton.png%7Cb101e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalho" "st%3A8079%2Fimg%2Ftwitterbutton.png%7Cb101e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fassets.dynatrace.com%2Fglobal%2Ficons%2Ffavicon.ico%7Cb101e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Frssbutton.png%7Cb101e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fprivacypolicy_5Flock.png%7Cb101e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction_5FVersiSign.png%7Cb101e0f0g0h0i0k0l105m110%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction_" "5Fcreditcards.png%7Cb101e0f0g0h0i0k0l100m105%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction_5Fcreditcode.png%7Cb102e0f0g0h0i0k0l109m111%7Chttp%3A%2F%2Flocalhost%3A8092%2Fimage%2Fwinter.jpeg%7Cb102e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Fplatform.twitter.com%2Fwidgets.js%7Cb102e1m1%7Chttps%3A%2F%2Fplatform.linkedin.com%2Fin.js%7Cb103e1m1%7Chttps%3A%2F%2Fassets.pinterest.com%2Fimages%2Fpidgets%2Fpinit_5Ffg_5Fen_5Frect_5Fgray_5F20.png%7Cb105e1m2%7Chttps%3A%2F%2Fassets.pinterest.com%2F" "js%2Fpinit.js%7Cb106e1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FGlobalProd.js%7Cb108e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery.js%7Cb109e0f0g0h0i0k0l0m1%7Chttps%3A%2F%2Fapis.google.com%2F_5F%2Fscs%2Fapps-static%2F_5F%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3Dplusone%2Frt%3Dj%2Fsv%3D1%2Fd%3D1%2Fed%3D1%2Fam%3DwQ%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA%2Fcb%3Dgapi.loaded_5F0%7Cb370e1m1%7Chttp%3A%2F%2Fconnect.facebook.net%2Fen_5FUS%2Fall.js%23xfbml%3D1%7Cb425e1f1g1h1i1k1l1m1%7Cht" "tp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fheader.png%7Cb428e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FLoginbox.png%7Cb428e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F4.png%7Cb428e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FButton_5F4.png%7Cb428e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FHauptfeld.png%7Cb428e0f0g0h0i0k0l0m0%7Chttp%3A" "%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction_5Ftextbox_5Fmedium1_5Fpage_5F3.png%7Cb428e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fplatform.linkedin.com%2Fjs%2FsecureAnonymousFramework%3Fv%3D1.0.328-1429%26lang%3Den_5FUS%7Cb471e1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FButton_5F1.png%7Cb499e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fmenupunkt_5Ftrennung_5Ftransparent.png%7Cb499e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVer" "lauf_5FOrange_5FHauptfeld.png%7Cb499e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator.png%7Cb499e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F1_5Finactive.png%7Cb499e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F2_5Finactive.png%7Cb499e0f0g0h0i0k0l30m39%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FSlider_5Fempty_5Fshadow.png%7Cb500e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fboo" "king%2Fstepindicator_5F3_5Factive.png%7Cb500e0f0g0h0i0k0l24m29%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F4_5Finactive.png%7Cb500e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction_5Ftextbox_5Flarge_5Fpage_5F3.png%7Cb500e0f0g0h0i0k0l19m29%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction_5Ftextbox_5Fmedium2_5Fpage_5F3.png%7Cb500e0f0g0h0i0k1l38m45%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FBooking_5Ftransaction" "_5Ftextbox_5Fsmall_5Fpage_5F3.png%7Cb501e0f0g0h0i0k0l32m37%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F1.png%7Cb501e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Fapps%2Fconnect%2Fsprites%2Fsprite_5Fconnect_5Fv14.png%7Cb501e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Flogo_5Flayer_5Fbottom.png%7Cb501e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Flogin%2FLoginwindow_5Ftextbox.png%7Cb501e0f0g0h0i0k0l0m0%7Chttp%3A%" "2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F3.png%7Cb501e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Fwidget_5Fiframe.bed9e19e565ca3b578705de9e73c29ed.html%3Forigin%3Dhttp_253A_252F_252Flocalhost_253A8079%26settingsEndpoint%3Dhttps_253A_252F_252Fsyndication.twitter.com_252Fsettings%7Cb534e223m235Bi5%7Chttps%3A%2F%2Fapis.google.com%2F_5F%2Fscs%2Fapps-static%2F_5F%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3Dauth%2Fexm%3Dplusone%2Frt%3Dj%2Fsv%3D1%2Fd%3D1%2Fed%" "3D1%2Fam%3DwQ%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA%2Fcb%3Dgapi.loaded_5F1%7Cb541e3m4%7Chttps%3A%2F%2Fapis.google.com%2Fse%2F0%2F_5F%2F%2B1%2Ffastbutton%7Cb561e199f199g199h199i199k199l200m237Bi%7Chttps%3A%2F%2Fplatform.twitter.com%2Fjs%2Fbutton.efa03583c158eb89fd00b8c75a70efae.js%7Cb566e1m1%7Chttps%3A%2F%2Faccounts.google.com%2Fo%2Foauth2%2FpostmessageRelay%7Cb590e171m216Bi%7Chttp%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_5Farbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%7Cb678e1m78Bi%7Chttps%3" "A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_5Farbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%7Cb710e160m362Bi%7Chttp%3A%2F%2Fassets.pinterest.com%2Fjs%2Fpinit_5Fmain.js%3F0.17254513468103805%7Cb712e0m93%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Ffollow_5Fbutton.bed9e19e565ca3b578705de9e73c29ed.en.html%7Cb730e93m320Bi%7Chttps%3A%2F%2Fwww.facebook.com%2Fplugins%2Flike.php%7Cb858e221f221g221h221i221k221l424m460Bi4%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Ffollow_5Fbutton.bed9e19e565ca3b5787" "05de9e73c29ed.en.html%7Cb1045m0Bi%7Chttps%3A%2F%2Fwww.facebook.com%2Fplugins%2Flike.php%7Cb1312m0Bi4%7Chttps%3A%2F%2Flog.pinterest.com%2F%7Cb1822e1m186$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449$title=easyTravel%20-%20Booking%20-%20Payment$latC=1$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534305430_219$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534310586", LAST); web_add_auto_header("Faces-Request", "partial/ajax"); addDynatraceHeaderTest("PC=orange-booking-payment.jsf_2;SI=LoadRunner;LSN=script name;"); web_submit_data("orange-booking-payment.jsf_2", "Action=http://localhost:8079/orange-booking-payment.jsf", "Method=POST", "RecContentType=text/xml", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t39.inf", "Mode=HTML", "EncodeAtSign=YES", ITEMDATA, "Name=iceform", "Value=iceform", ENDITEM, "Name=javax.faces.ViewState", "Value=-932247047312321508:6671456150616442616", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp72q", ENDITEM, "Name=iceform:creditCardType", "Value=VISA", ENDITEM, "Name=iceform:creditCardNumber", "Value=123123", ENDITEM, "Name=iceform:creditCardOwner", "Value=adsd", ENDITEM, "Name=iceform:expirationMonth", "Value=March", ENDITEM, "Name=iceform:expirationYear", "Value=2019", ENDITEM, "Name=iceform:verificationNumber", "Value=111", ENDITEM, "Name=icefacesCssUpdates", "Value=", ENDITEM, "Name=iceform:j_idcl", "Value=", ENDITEM, "Name=javax.faces.source", "Value=iceform:bookPaymentNext", ENDITEM, "Name=javax.faces.partial.event", "Value=click", ENDITEM, "Name=javax.faces.partial.execute", "Value=@all", ENDITEM, "Name=javax.faces.partial.render", "Value=@all", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp72q", ENDITEM, "Name=ice.focus", "Value=iceform:bookPaymentNext", ENDITEM, "Name=iceform:bookPaymentNext", "Value=Next", ENDITEM, "Name=ice.event.target", "Value=iceform:bookPaymentNext", ENDITEM, "Name=ice.event.captured", "Value=iceform:bookPaymentNext", ENDITEM, "Name=ice.event.type", "Value=onclick", ENDITEM, "Name=ice.event.alt", "Value=false", ENDITEM, "Name=ice.event.ctrl", "Value=false", ENDITEM, "Name=ice.event.shift", "Value=false", ENDITEM, "Name=ice.event.meta", "Value=false", ENDITEM, "Name=ice.event.x", "Value=1020", ENDITEM, "Name=ice.event.y", "Value=480", ENDITEM, "Name=ice.event.left", "Value=true", ENDITEM, "Name=ice.event.right", "Value=false", ENDITEM, "Name=ice.submit.type", "Value=ice.s", ENDITEM, "Name=ice.submit.serialization", "Value=form", ENDITEM, "Name=javax.faces.partial.ajax", "Value=true", ENDITEM, EXTRARES, "Url=http://localhost:8092/image/easyTravel_banner.png", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, "Url=/img/header3.jpg", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=orange-booking-payment.jsf_3;SI=LoadRunner;LSN=script name;"); web_submit_data("orange-booking-payment.jsf_3", "Action=http://localhost:8079/orange-booking-payment.jsf", "Method=POST", "RecContentType=text/xml", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t40.inf", "Mode=HTML", "EncodeAtSign=YES", ITEMDATA, "Name=iceform", "Value=iceform", ENDITEM, "Name=javax.faces.ViewState", "Value=-932247047312321508:6671456150616442616", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp72q", ENDITEM, "Name=iceform:creditCardType", "Value=VISA", ENDITEM, "Name=iceform:creditCardNumber", "Value=2222333344445555", ENDITEM, "Name=iceform:creditCardOwner", "Value=adsd", ENDITEM, "Name=iceform:expirationMonth", "Value=March", ENDITEM, "Name=iceform:expirationYear", "Value=2019", ENDITEM, "Name=iceform:verificationNumber", "Value=111", ENDITEM, "Name=icefacesCssUpdates", "Value=", ENDITEM, "Name=iceform:j_idcl", "Value=", ENDITEM, "Name=javax.faces.source", "Value=iceform:bookPaymentNext", ENDITEM, "Name=javax.faces.partial.event", "Value=click", ENDITEM, "Name=javax.faces.partial.execute", "Value=@all", ENDITEM, "Name=javax.faces.partial.render", "Value=@all", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp72q", ENDITEM, "Name=ice.focus", "Value=iceform:bookPaymentNext", ENDITEM, "Name=iceform:bookPaymentNext", "Value=Next", ENDITEM, "Name=ice.event.target", "Value=iceform:bookPaymentNext", ENDITEM, "Name=ice.event.captured", "Value=iceform:bookPaymentNext", ENDITEM, "Name=ice.event.type", "Value=onclick", ENDITEM, "Name=ice.event.alt", "Value=false", ENDITEM, "Name=ice.event.ctrl", "Value=false", ENDITEM, "Name=ice.event.shift", "Value=false", ENDITEM, "Name=ice.event.meta", "Value=false", ENDITEM, "Name=ice.event.x", "Value=1029", ENDITEM, "Name=ice.event.y", "Value=489", ENDITEM, "Name=ice.event.left", "Value=true", ENDITEM, "Name=ice.event.right", "Value=false", ENDITEM, "Name=ice.submit.type", "Value=ice.s", ENDITEM, "Name=ice.submit.serialization", "Value=form", ENDITEM, "Name=javax.faces.partial.ajax", "Value=true", ENDITEM, LAST); web_add_cookie("dtSa=true%7CU%7C-1%7CNext%7C-%7C1530534322790%7C534305430_219%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Payment%7C1530534310588%7C; DOMAIN=localhost"); web_revert_auto_header("Faces-Request"); web_add_cookie("dtPC=1$534324386_970h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536124389|1530534276697; DOMAIN=localhost"); web_add_cookie("dtLatC=17; DOMAIN=localhost"); addDynatraceHeaderTest("PC=orange-booking-finish.jsf;SI=LoadRunner;LSN=script name;"); web_url("orange-booking-finish.jsf", "URL=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-payment.jsf?journeyId=9449", "Snapshot=t41.inf", "Mode=HTML", EXTRARES, "Url=/img/booking/Slider_empty.png", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", ENDITEM, "Url=/img/booking/stepindicator_4_active.png", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_4;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_4", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t42.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_4;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_4", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t43.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_4;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_4", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t44.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.5688087694051419", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_5;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_5", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t45.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_4;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_4", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t46.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_4;SI=LoadRunner;LSN=script name;"); web_url("like.php_4", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Dfd9a51bbf694d4%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ff7fd594af1cd0c%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t47.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=jot_3;SI=LoadRunner;LSN=script name;"); web_submit_data("jot_3", "Action=https://syndication.twitter.com/i/jot", "Method=POST", "RecContentType=text/html", "Referer=", "Snapshot=t48.inf", "Mode=HTML", ITEMDATA, "Name=dnt", "Value=0", ENDITEM, "Name=tfw_redirect", "Value=https://platform.twitter.com/jot.html", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-finish.jsf?journeyId=9449\",\"widget_frame\":false,\"language\":\"en\",\"message\":\"m:withcount:\",\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534325129,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"page\":\"button\",\"section\":\"follow\",\"action\":\"impression\"}}", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-finish.jsf?journeyId=9449\",\"widget_frame\":null,\"duration_ms\":256.30794153024794,\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534325130,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"action\":\"render\",\"page\":\"page\",\"component\":\"performance\"}}", ENDITEM, LAST); addDynatraceHeaderTest("PC=log.pinterest.com_4;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com_4", "URL=https://log.pinterest.com/?guid=sirnaakLrme1&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449&callback=PIN_1530534324843.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t49.inf", "Mode=HTML", LAST); web_add_cookie("rxvt=1530536127564|1530534276697; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_7;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_7", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t50.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=d%7C-1%7CNext%7CU%7C-%7C534305430_219%7C1530534322790%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Payment%2C1%7C1%7C_load_%7C_load_%7C-%7C1530534324097%7C1530534325509%7C207%7C-%7C-%7C-%7C-%7C-%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-payment.jsf%3FjourneyId%3D9449%2C2%7C2%7C_onload_%7C_load_%7C-%7C1530534325507%7C1530534325509%7C206$rId=RID_864209405$rpId=770995669$domR=1530534325506$w=1920$h=1082$sw=1920$sh=" "1200$nt=a0b1530534324097e16f16g16h16i16k34l36m38n36o462p462q520r1409s1410t1412$V=869|c$S=406$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449$title=easyTravel%20-%20Booking%20-%20Finish$vd=16975$latC=17$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534324386_970$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534327564", LAST); web_add_cookie("rxvt=1530536125557|1530534276697; DOMAIN=localhost"); web_add_header("Faces-Request", "partial/ajax"); addDynatraceHeaderTest("PC=orange-booking-finish.jsf_2;SI=LoadRunner;LSN=script name;"); web_submit_data("orange-booking-finish.jsf_2", "Action=http://localhost:8079/orange-booking-finish.jsf", "Method=POST", "RecContentType=text/xml", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t51.inf", "Mode=HTML", "EncodeAtSign=YES", ITEMDATA, "Name=iceform", "Value=iceform", ENDITEM, "Name=javax.faces.ViewState", "Value=261378843353078209:-6429494183871565578", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp73m", ENDITEM, "Name=icefacesCssUpdates", "Value=", ENDITEM, "Name=javax.faces.source", "Value=iceform:bookFinishFinish", ENDITEM, "Name=javax.faces.partial.event", "Value=click", ENDITEM, "Name=javax.faces.partial.execute", "Value=@all", ENDITEM, "Name=javax.faces.partial.render", "Value=@all", ENDITEM, "Name=ice.window", "Value=oqjj48l9qs", ENDITEM, "Name=ice.view", "Value=vfxe7zp73m", ENDITEM, "Name=ice.focus", "Value=iceform:bookFinishFinish", ENDITEM, "Name=iceform:bookFinishFinish", "Value=Finish", ENDITEM, "Name=ice.event.target", "Value=iceform:bookFinishFinish", ENDITEM, "Name=ice.event.captured", "Value=iceform:bookFinishFinish", ENDITEM, "Name=ice.event.type", "Value=onclick", ENDITEM, "Name=ice.event.alt", "Value=false", ENDITEM, "Name=ice.event.ctrl", "Value=false", ENDITEM, "Name=ice.event.shift", "Value=false", ENDITEM, "Name=ice.event.meta", "Value=false", ENDITEM, "Name=ice.event.x", "Value=978", ENDITEM, "Name=ice.event.y", "Value=485", ENDITEM, "Name=ice.event.left", "Value=true", ENDITEM, "Name=ice.event.right", "Value=false", ENDITEM, "Name=ice.submit.type", "Value=ice.s", ENDITEM, "Name=ice.submit.serialization", "Value=form", ENDITEM, "Name=javax.faces.partial.ajax", "Value=true", ENDITEM, LAST); web_add_cookie("dtPC=1$534324386_970h-vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536129239|1530534276697; DOMAIN=localhost"); web_add_cookie("dtSa=true%7CC%7C-1%7CFinish%7C-%7C1530534327007%7C534324386_970%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Finish%7C1530534327566%7C; DOMAIN=localhost"); web_add_cookie("dtLatC=2; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_8;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_8", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t52.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$3p=" "1-1530534324097%3Blocalhost%7Cu%7C26%7C0%7C0%7C8%7C0%7C26%7C%7C0%7C0%7C0%7C55_86_389_389_461_490%7C0%7C0%7C30%7C13%7C0%7C0%7C13%7C0%7C13%7C%7C0%7C0%7C0%7C43_51_63_64%7C0%7C0%7C1%7C5%7C0%7C0%7C5%7C39_43%7C1%7C1%7C1%7C4%7C0%7C0%7C4%7C52_55%7C1%7C1%7C1%3Bapis.google.com%7Ck%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C51_52%7C1%7C1%7C1%7C3%7C0%7C0%7C2%7C337_339_497_498_515_743%7C76%7C1%7C228%3Bassets.dynatrace.com%7C2%7C1%7C0%7C0%7C0%7C0%7C1%7C%7C0%7C0%7C0%7C56_56%7C0%7C0%7C0%3Bplatform.twitter.com%7Ck%7" "C2%7C0%7C0%7C2%7C0%7C2%7C%7C0%7C0%7C0%7C57_59_521_522%7C1%7C1%7C2%7C3%7C0%7C0%7C1%7C492_825%7C122%7C0%7C189%3Bplatform.linkedin.com%7Ck%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C59_60%7C1%7C1%7C1%7C1%7C0%7C0%7C1%7C434_435%7C1%7C1%7C1%3Bassets.pinterest.com%7C6%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C61_62%7C1%7C1%7C1%7C2%7C0%7C0%7C1%7C0%7C2%7C%7C0%7C0%7C0%7C62_63_631_726%7C48%7C1%7C95%3Bconnect.facebook.net%7C4%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C386_388%7C1%7C1%7C1%3Bstatic.licdn.com%7C2%7C1" "%7C0%7C0%7C0%7C0%7C1%7C%7C0%7C0%7C0%7C462_462%7C0%7C0%7C0%3Baccounts.google.com%7Cg%7C1%7C0%7C0%7C0%7C545_760%7C215%7C215%7C215%3Bstaticxx.facebook.com%7C4%7C2%7C0%7C0%7C0%7C0%7C2%7C%7C0%7C0%7C0%7C595_797%7C120%7C73%7C168%3Bwww.facebook.com%7Cg%7C2%7C0%7C0%7C1%7C861_1313%7C226%7C0%7C452%3Blog.pinterest.com%7Cg%7C1%7C0%7C0%7C0%7C1773_1971%7C198%7C198%7C198$rt=" "1-1530534324097%3Bhttp%3A%2F%2Flocalhost%3A8079%2Fcss%2FBaseProd.css%7Cb39e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Ffooter.css%7Cb40e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Frime.css%7Cb41e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Frating.css%7Cb42e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Forange.css%7Cb42e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery-1.8.1.js%7Cb43e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquer" "y-ui-1.8.2.min.js%7Cb44e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fversion.js%7Cb44e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FdtagentApi.js%7Cb45e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FFrameworkProd.js%7Cb46e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery.formLabels1.0.js%7Cb46e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FheaderRotation.js%7Cb48e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Frating.js%7Cb49e1f1g1h1i1k1l1m1%7C" "http%3A%2F%2Flocalhost%3A8079%2Fjs%2Frecommendation.js%7Cb50e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fproblempatterns%2Fchangedetectionlib.js%7Cb50e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fusertimings.js%7Cb51e1f1g1h1i1k1l1m1%7Chttps%3A%2F%2Fapis.google.com%2Fjs%2Fplusone.js%7Cb51e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fjsf.js.jsf%3Fln%3Djavax.faces%7Cb52e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%3" "Frand%3D963083509%7Cb53e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fcompat.js.jsf%7Cb54e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Ficefaces-compat.js.jsf%7Cb55e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fapple%2Fapple.png%7Cb55e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fandroidbutton.png%7Cb55e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Ffacebookbutton.png%7Cb56e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3" "A8079%2Fimg%2Ftwitterbutton.png%7Cb56e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fassets.dynatrace.com%2Fglobal%2Ficons%2Ffavicon.ico%7Cb56e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Frssbutton.png%7Cb56e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fprivacypolicy_5Flock.png%7Cb56e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FeasyTravel_5Fbookingtransaction_5FHeader.png%7Cb56e0f0g0h0i0k0l13m30%7Chttp%3A%2F%2Flocalhost%3A8092%2Fimage%2Froad1.png%7Cb56e0f0g0h0i0k0l0m2%7C" "http%3A%2F%2Fplatform.twitter.com%2Fwidgets.js%7Cb57e2m2%7Chttps%3A%2F%2Fplatform.linkedin.com%2Fin.js%7Cb59e1m1%7Chttps%3A%2F%2Fassets.pinterest.com%2Fimages%2Fpidgets%2Fpinit_5Ffg_5Fen_5Frect_5Fgray_5F20.png%7Cb61e1m1%7Chttps%3A%2F%2Fassets.pinterest.com%2Fjs%2Fpinit.js%7Cb62e1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FGlobalProd.js%7Cb63e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery.js%7Cb64e1f1g1h1i1k1l1m1%7Chttps%3A%2F%2Fapis.google.com%2F_5F%2Fscs%2Fapps-static%2F_5F%2Fjs%2Fk%" "3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3Dplusone%2Frt%3Dj%2Fsv%3D1%2Fd%3D1%2Fed%3D1%2Fam%3DwQ%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA%2Fcb%3Dgapi.loaded_5F0%7Cb337e1m1%7Chttp%3A%2F%2Fconnect.facebook.net%2Fen_5FUS%2Fall.js%23xfbml%3D1%7Cb386e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F4.png%7Cb389e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FButton_5F4.png%7Cb389e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fim" "g%2Fheader.png%7Cb389e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FLoginbox.png%7Cb389e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FHauptfeld.png%7Cb389e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FButton_5F1.png%7Cb389e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fplatform.linkedin.com%2Fjs%2FsecureAnonymousFramework%3Fv%3D1.0.328-1429%26lang%3Den_5FUS%7Cb434e1m1%7Chttp%3A%2F%2Flocalhost%3A807" "9%2Fimg%2Fmenupunkt_5Ftrennung_5Ftransparent.png%7Cb461e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FHauptfeld.png%7Cb461e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator.png%7Cb461e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F1_5Finactive.png%7Cb461e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F2_5Finactive.png%7Cb461e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocal" "host%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F3_5Finactive.png%7Cb461e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FSlider_5Fempty.png%7Cb461e0f0g0h0i0k0l14m16%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F4_5Factive.png%7Cb462e0f0g0h0i0k14l27m28%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F1.png%7Cb462e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Fapps%2Fconnect%2Fsprites%2Fsprite_5Fconnect_5" "Fv14.png%7Cb462e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Flogo_5Flayer_5Fbottom.png%7Cb462e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Flogin%2FLoginwindow_5Ftextbox.png%7Cb462e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F3.png%7Cb462e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Fwidget_5Fiframe.bed9e19e565ca3b578705de9e73c29ed.html%3Forigin%3Dhttp_253A_252F_252Flocalhost_253A8079%26settingsEndpoint%3Dhttps" "_253A_252F_252Fsyndication.twitter.com_252Fsettings%7Cb492e178m189Bi5%7Chttps%3A%2F%2Fapis.google.com%2F_5F%2Fscs%2Fapps-static%2F_5F%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3Dauth%2Fexm%3Dplusone%2Frt%3Dj%2Fsv%3D1%2Fd%3D1%2Fed%3D1%2Fam%3DwQ%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA%2Fcb%3Dgapi.loaded_5F1%7Cb497e1m1%7Chttps%3A%2F%2Fapis.google.com%2Fse%2F0%2F_5F%2F%2B1%2Ffastbutton%7Cb515e157f157g157h157i157k157l158m228Bi%7Chttps%3A%2F%2Fplatform.twitter.com%2Fjs%2Fbutton.efa03583c158eb89fd00b8c75" "a70efae.js%7Cb521e1m1%7Chttps%3A%2F%2Faccounts.google.com%2Fo%2Foauth2%2FpostmessageRelay%7Cb545e129m215Bi%7Chttp%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_5Farbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%7Cb595e1m73Bi%7Chttps%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_5Farbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%7Cb629e140m168Bi%7Chttp%3A%2F%2Fassets.pinterest.com%2Fjs%2Fpinit_5Fmain.js%3F0.5688087694051419%7Cb631e0m95%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Ffollow_5Fbutton.bed9e19e56" "5ca3b578705de9e73c29ed.en.html%7Cb647e125m178Bi%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Ffollow_5Fbutton.bed9e19e565ca3b578705de9e73c29ed.en.html%7Cb822m0Bi%7Chttps%3A%2F%2Fwww.facebook.com%2Fplugins%2Flike.php%7Cb861e415f415g415h415i415k415l419m452Bi4%7Chttps%3A%2F%2Fwww.facebook.com%2Fplugins%2Flike.php%7Cb1308m0Bi4%7Chttps%3A%2F%2Flog.pinterest.com%2F%7Cb1773e0m198$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449$title=" "easyTravel%20-%20Booking%20-%20Finish$isUnload=true$latC=2$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534324386_970$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534329239", LAST); web_add_cookie("dtPC=1$534329542_11h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536129545|1530534276697; DOMAIN=localhost"); addDynatraceHeaderTest("PC=orange-booking-finish.jsf_3;SI=LoadRunner;LSN=script name;"); web_url("orange-booking-finish.jsf_3", "URL=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?journeyId=9449", "Snapshot=t53.inf", "Mode=HTML", EXTRARES, "Url=/img/gradient/Verlauf_Orange_Button_2.png", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_5;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_5", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t54.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_5;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_5", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t55.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_5;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_5", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t56.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.034845580390163", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", ENDITEM, LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_6;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_6", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t57.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_5;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_5", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t58.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_5;SI=LoadRunner;LSN=script name;"); web_url("like.php_5", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df3ecbbcb781a1d8%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ff3db9a69f04b4b%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t59.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=jot_4;SI=LoadRunner;LSN=script name;"); web_submit_data("jot_4", "Action=https://syndication.twitter.com/i/jot", "Method=POST", "RecContentType=text/html", "Referer=", "Snapshot=t60.inf", "Mode=HTML", ITEMDATA, "Name=dnt", "Value=0", ENDITEM, "Name=tfw_redirect", "Value=https://platform.twitter.com/jot.html", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449\",\"widget_frame\":false,\"language\":\"en\",\"message\":\"m:withcount:\",\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534330337,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"page\":\"button\",\"section\":\"follow\",\"action\":\"impression\"}}", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449\",\"widget_frame\":null,\"duration_ms\":329.4270629159096,\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534330338,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"action\":\"render\",\"page\":\"page\",\"component\":\"performance\"}}", ENDITEM, LAST); addDynatraceHeaderTest("PC=log.pinterest.com_5;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com_5", "URL=https://log.pinterest.com/?guid=uS1fyx8kc1ZY&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449&callback=PIN_1530534329988.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t61.inf", "Mode=HTML", LAST); web_add_cookie("rxvt=1530536132575|1530534276697; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_9;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_9", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t62.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=d%7C-1%7CFinish%7CC%7C-%7C534324386_970%7C1530534327007%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Finish%2C1%7C1%7C_load_%7C_load_%7C-%7C1530534329243%7C1530534331366%7C209%7C-%7C-%7C-%7C-%7C-%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3FjourneyId%3D9449%2C2%7C2%7C_onload_%7C_load_%7C-%7C1530534331365%7C1530534331366%7C209$rId=RID_94524396$rpId=865248795$domR=1530534331364$w=1920$h=1082$sw=1920$sh=" "1200$nt=a0b1530534329243e15f15g15h15i15k34l36m38n36o464p464q521r2121s2122t2123$V=946|c$S=439$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449$title=easyTravel%20-%20Booking%20-%20Finish$vd=5008$latC=17$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534329542_11$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534332574", LAST); web_add_cookie("dtPC=1$534329542_11h-vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536134011|1530534276697; DOMAIN=localhost"); web_add_cookie("dtSa=true%7CC%7C-1%7CNew%20Search%7C-%7C1530534333959%7C534329542_11%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Finish%7C1530534332576%7C; DOMAIN=localhost"); addDynatraceHeaderTest("PC=orange.jsf_2;SI=LoadRunner;LSN=script name;"); web_url("orange.jsf_2", "URL=http://localhost:8079/orange.jsf", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t63.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.3874888186402181", ENDITEM, LAST); addDynatraceHeaderTest("PC=rb_1_10;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_10", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange-booking-finish.jsf?success=1&journeyId=9449", "Snapshot=t64.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$3p=" "1-1530534329243%3Blocalhost%7Cu%7C25%7C0%7C0%7C7%7C0%7C25%7C%7C0%7C0%7C0%7C54_55_400_400_463_479%7C0%7C0%7C16%7C13%7C0%7C0%7C13%7C0%7C13%7C%7C0%7C0%7C0%7C43_50_58_60%7C0%7C0%7C1%7C5%7C0%7C0%7C5%7C39_43%7C0%7C0%7C1%7C4%7C0%7C0%7C4%7C51_54%7C1%7C1%7C1%3Bapis.google.com%7Ck%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C51_51%7C1%7C1%7C1%7C3%7C0%7C0%7C2%7C346_348_493_494_517_738%7C74%7C1%7C221%3Bassets.dynatrace.com%7C2%7C1%7C0%7C0%7C0%7C0%7C1%7C%7C0%7C0%7C0%7C54_54%7C0%7C0%7C0%3Bplatform.twitter.com%7Ck%7" "C2%7C0%7C0%7C2%7C0%7C2%7C%7C0%7C0%7C0%7C55_56_521_523%7C1%7C1%7C1%7C3%7C0%7C0%7C1%7C488_904%7C158%7C0%7C258%3Bplatform.linkedin.com%7Ck%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C56_57%7C1%7C1%7C1%7C1%7C0%7C0%7C1%7C438_439%7C1%7C1%7C1%3Bassets.pinterest.com%7C6%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C57_57%7C1%7C1%7C1%7C2%7C0%7C0%7C1%7C0%7C2%7C%7C0%7C0%7C0%7C57_58_627_743%7C58%7C1%7C115%3Bconnect.facebook.net%7C4%7C1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C397_398%7C1%7C1%7C1%3Bstatic.licdn.com%7C2%7C" "1%7C0%7C0%7C1%7C0%7C1%7C%7C0%7C0%7C0%7C464_464%7C0%7C0%7C0%3Baccounts.google.com%7Cg%7C1%7C0%7C0%7C0%7C545_745%7C200%7C200%7C200%3Bstaticxx.facebook.com%7C4%7C2%7C0%7C0%7C0%7C0%7C2%7C%7C0%7C0%7C0%7C596_877%7C174%7C97%7C251%3Bwww.facebook.com%7Cg%7C2%7C0%7C0%7C1%7C937_2028%7C545%7C0%7C1091%3Blog.pinterest.com%7Cg%7C1%7C0%7C0%7C0%7C1762_2019%7C257%7C257%7C257$rt=" "1-1530534329243%3Bhttp%3A%2F%2Flocalhost%3A8079%2Fcss%2FBaseProd.css%7Cb39e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Ffooter.css%7Cb40e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Frime.css%7Cb41e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Frating.css%7Cb42e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fcss%2Forange.css%7Cb42e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery-1.8.1.js%7Cb43e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquer" "y-ui-1.8.2.min.js%7Cb44e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fversion.js%7Cb44e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FdtagentApi.js%7Cb45e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FFrameworkProd.js%7Cb46e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery.formLabels1.0.js%7Cb47e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FheaderRotation.js%7Cb48e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Frating.js%7Cb48e0f0g0h0i0k0l0m1%7C" "http%3A%2F%2Flocalhost%3A8079%2Fjs%2Frecommendation.js%7Cb49e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fproblempatterns%2Fchangedetectionlib.js%7Cb50e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fusertimings.js%7Cb50e0f0g0h0i0k0l0m1%7Chttps%3A%2F%2Fapis.google.com%2Fjs%2Fplusone.js%7Cb51e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fjsf.js.jsf%3Fln%3Djavax.faces%7Cb51e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fbridge.js.jsf%3" "Frand%3D963083509%7Cb52e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Fcompat.js.jsf%7Cb53e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjavax.faces.resource%2Ficefaces-compat.js.jsf%7Cb53e0f0g0h0i0k0l0m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fapple%2Fapple.png%7Cb54e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fandroidbutton.png%7Cb54e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Ffacebookbutton.png%7Cb54e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3" "A8079%2Fimg%2Ftwitterbutton.png%7Cb54e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fassets.dynatrace.com%2Fglobal%2Ficons%2Ffavicon.ico%7Cb54e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Frssbutton.png%7Cb54e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fprivacypolicy_5Flock.png%7Cb54e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FeasyTravel_5Fbookingtransaction_5FHeader.png%7Cb55e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8092%2Fimage%2FeasyTravel_5Fbanner.png%7Cb55e0f0g0h" "0i0k0l0m1%7Chttp%3A%2F%2Fplatform.twitter.com%2Fwidgets.js%7Cb55e1m1%7Chttps%3A%2F%2Fplatform.linkedin.com%2Fin.js%7Cb56e0m1%7Chttps%3A%2F%2Fassets.pinterest.com%2Fimages%2Fpidgets%2Fpinit_5Ffg_5Fen_5Frect_5Fgray_5F20.png%7Cb57e0m1%7Chttps%3A%2F%2Fassets.pinterest.com%2Fjs%2Fpinit.js%7Cb57e1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2FGlobalProd.js%7Cb58e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fjs%2Fjquery.js%7Cb59e0f0g0h0i0k0l0m1%7Chttps%3A%2F%2Fapis.google.com%2F_5F%2Fscs%2Fapps-static%2F_" "5F%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3Dplusone%2Frt%3Dj%2Fsv%3D1%2Fd%3D1%2Fed%3D1%2Fam%3DwQ%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA%2Fcb%3Dgapi.loaded_5F0%7Cb346e1m1%7Chttp%3A%2F%2Fconnect.facebook.net%2Fen_5FUS%2Fall.js%23xfbml%3D1%7Cb397e1f1g1h1i1k1l1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fheader.png%7Cb400e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FLoginbox.png%7Cb400e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5" "FOrange_5FButton_5F4.png%7Cb400e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F4.png%7Cb400e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fplatform.linkedin.com%2Fjs%2FsecureAnonymousFramework%3Fv%3D1.0.328-1429%26lang%3Den_5FUS%7Cb438e1m1%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fmenupunkt_5Ftrennung_5Ftransparent.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FHauptfeld.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost" "%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FHauptfeld.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F1_5Finactive.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F2_5Finactive.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F3_5Finactive.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%" "2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2FSlider_5Fempty.png%7Cb463e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fbooking%2Fstepindicator_5F4_5Factive.png%7Cb464e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FOrange_5FButton_5F2.png%7Cb464e0f0g0h0i0k0l15m16%7Chttps%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Fapps%2Fconnect%2Fsprites%2Fsprite_5Fconnect_5Fv14.png%7Cb464e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Flogo_5Flayer_5Fbottom.png" "%7Cb464e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Flogin%2FLoginwindow_5Ftextbox.png%7Cb464e0f0g0h0i0k0l0m0%7Chttp%3A%2F%2Flocalhost%3A8079%2Fimg%2Fgradient%2FVerlauf_5FGrau_5FButton_5F3.png%7Cb464e0f0g0h0i0k0l0m0%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Fwidget_5Fiframe.bed9e19e565ca3b578705de9e73c29ed.html%3Forigin%3Dhttp_253A_252F_252Flocalhost_253A8079%26settingsEndpoint%3Dhttps_253A_252F_252Fsyndication.twitter.com_252Fsettings%7Cb488e206m218Bi5%7Chttps%3A%2F%2Fapis.google" ".com%2F_5F%2Fscs%2Fapps-static%2F_5F%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3Dauth%2Fexm%3Dplusone%2Frt%3Dj%2Fsv%3D1%2Fd%3D1%2Fed%3D1%2Fam%3DwQ%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA%2Fcb%3Dgapi.loaded_5F1%7Cb493e1m1%7Chttps%3A%2F%2Fapis.google.com%2Fse%2F0%2F_5F%2F%2B1%2Ffastbutton%7Cb517e179f179g179h179i179k179l180m221Bi%7Chttps%3A%2F%2Fplatform.twitter.com%2Fjs%2Fbutton.efa03583c158eb89fd00b8c75a70efae.js%7Cb521e1m1%7Chttps%3A%2F%2Faccounts.google.com%2Fo%2Foauth2%2FpostmessageRelay%7Cb545e" "154m200Bi%7Chttp%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_5Farbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%7Cb596e1m97Bi%7Chttps%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_5Farbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%7Cb626e138m251Bi%7Chttp%3A%2F%2Fassets.pinterest.com%2Fjs%2Fpinit_5Fmain.js%3F0.034845580390163%7Cb627e0m115%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2Ffollow_5Fbutton.bed9e19e565ca3b578705de9e73c29ed.en.html%7Cb646e205m258Bi%7Chttps%3A%2F%2Fplatform.twitter.com%2Fwidgets%2F" "follow_5Fbutton.bed9e19e565ca3b578705de9e73c29ed.en.html%7Cb902m0Bi%7Chttps%3A%2F%2Fwww.facebook.com%2Fplugins%2Flike.php%7Cb937e847f847g847h847i847k847l865m1091Bi4%7Chttps%3A%2F%2Flog.pinterest.com%2F%7Cb1762e1m257%7Chttps%3A%2F%2Fwww.facebook.com%2Fplugins%2Flike.php%7Cb2023m0Bi4$url=http%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449$title=easyTravel%20-%20Booking%20-%20Finish$isUnload=true$latC=1$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534329542_11$v" "=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534334011", LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_6;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_6", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t65.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_6;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_6", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t66.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_6;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_6", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t67.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_6;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_6", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t68.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_7;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_7", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t69.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_6;SI=LoadRunner;LSN=script name;"); web_url("like.php_6", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df38bb36ed573204%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ff3153c0432816b%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t70.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=log.pinterest.com_6;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com_6", "URL=https://log.pinterest.com/?guid=hZDcZ7TYKvsQ&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2Forange.jsf&callback=PIN_1530534334961.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t71.inf", "Mode=HTML", LAST); web_add_cookie("dtPC=1$534334382_303h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536138089|1530534276697; DOMAIN=localhost"); web_add_cookie("dtSa=true%7CC%7C-1%7CLogout%7C-%7C1530534338029%7C534334382_303%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange.jsf%7CeasyTravel%20-%20One%20step%20to%20happiness%7C1530534332576%7C; DOMAIN=localhost"); web_add_cookie("dtLatC=38; DOMAIN=localhost"); addDynatraceHeaderTest("PC=j_invalidate_session;SI=LoadRunner;LSN=script name;"); web_url("j_invalidate_session", "URL=http://localhost:8079/j_invalidate_session", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t72.inf", "Mode=HTML", LAST); web_add_cookie("JSESSIONID=72EB3CB4C6062B6D52E6E59F8724DFC2.jvmRoute-8280; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_11;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_11", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Forange.jsf&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t73.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=d%7C-1%7CNew%20Search%7CC%7C-%7C534329542_11%7C1530534333959%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449%7CeasyTravel%20-%20Booking%20-%20Finish%2C1%7C1%7C_load_%7C_load_%7C-%7C1530534334015%7C0%7C341%7C-%7C-%7C-%7C-%7C-%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange-booking-finish.jsf%3Fsuccess%3D1%26journeyId%3D9449$rId=RID_-1981805739$rpId=1544108374$domR=1530534334569$w=1920$h=1082$sw=1920$sh=1200$nt=" "a0b1530534334015e45f45g45h45i45k76l79m81n79o554p554q606$V=3968|f$S=501$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2Forange.jsf$title=easyTravel%20-%20One%20step%20to%20happiness$vd=5511$isUnload=true$latC=38$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534334382_303$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534338088", LAST); addDynatraceHeaderTest("PC=jot_5;SI=LoadRunner;LSN=script name;"); web_submit_data("jot_5", "Action=https://syndication.twitter.com/i/jot", "Method=POST", "RecContentType=text/html", "Referer=", "Snapshot=t74.inf", "Mode=HTML", ITEMDATA, "Name=dnt", "Value=0", ENDITEM, "Name=tfw_redirect", "Value=https://platform.twitter.com/jot.html", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange.jsf\",\"widget_frame\":false,\"language\":\"en\",\"message\":\"m:withcount:\",\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534335137,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"page\":\"button\",\"section\":\"follow\",\"action\":\"impression\"}}", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/orange.jsf\",\"widget_frame\":null,\"duration_ms\":209.37995274728064,\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534335137,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"action\":\"render\",\"page\":\"page\",\"component\":\"performance\"}}", ENDITEM, LAST); addDynatraceHeaderTest("PC=j_invalidate_session_2;SI=LoadRunner;LSN=script name;"); web_url("j_invalidate_session_2", "URL=http://localhost:8079/j_invalidate_session", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/orange.jsf", "Snapshot=t75.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.0728040569722922", "Referer=http://localhost:8079/logout.jsf", ENDITEM, LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_7;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_7", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t76.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_7;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_7", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t77.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_7;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_7", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t78.inf", "Mode=HTML", LAST); web_add_cookie("dtPC=1$534334382_303h1p1$534338958_59h1vIFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536139060|1530534276697; DOMAIN=localhost"); web_add_cookie("dtLatC=53; DOMAIN=localhost"); addDynatraceHeaderTest("PC=rb_1_12;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_12", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Flogout.jsf&visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t79.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=1%7C2%7Cvisit%20end%7C_endVisit_%7C-%7C1530534339057%7C1530534339057%7C-1$rId=RID_-838773383$rpId=-1669656246$fd=j1.8.1^so1.7^six$url=http%3A%2F%2Flocalhost%3A8079%2Flogout.jsf$title=easyTravel%20-%20Logout$vd=6483$latC=53$visitID=IFEDHEFAOHPTKMBFAJCMFLDKJBCJNIBN$fId=534338958_59$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534339060", LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_7;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_7", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t80.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_8;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_8", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t81.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_7;SI=LoadRunner;LSN=script name;"); web_url("like.php_7", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Dfd1598f6287bf5%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ffde7b793e2cfe9%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t82.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=jot_6;SI=LoadRunner;LSN=script name;"); web_submit_data("jot_6", "Action=https://syndication.twitter.com/i/jot", "Method=POST", "RecContentType=text/html", "Referer=", "Snapshot=t83.inf", "Mode=HTML", ITEMDATA, "Name=dnt", "Value=0", ENDITEM, "Name=tfw_redirect", "Value=https://platform.twitter.com/jot.html", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/logout.jsf\",\"widget_frame\":false,\"language\":\"en\",\"message\":\"m:withcount:\",\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534339633,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"page\":\"button\",\"section\":\"follow\",\"action\":\"impression\"}}", ENDITEM, "Name=l", "Value={\"widget_origin\":\"http://localhost:8079/logout.jsf\",\"widget_frame\":null,\"duration_ms\":204.81889926309827,\"_category_\":\"tfw_client_event\",\"triggered_on\":1530534339633,\"dnt\":false,\"client_version\":\"910cbce:1530167310832\",\"format_version\":1,\"event_namespace\":{\"client\":\"tfw\",\"action\":\"render\",\"page\":\"page\",\"component\":\"performance\"}}", ENDITEM, LAST); addDynatraceHeaderTest("PC=log.pinterest.com_7;SI=LoadRunner;LSN=script name;"); web_url("log.pinterest.com_7", "URL=https://log.pinterest.com/?guid=yKy0HPdLED1V&tv=2018050702&type=pidget&sub=pl&button_count=1&follow_count=0&pin_count=0&profile_count=0&board_count=0&section_count=0&lang=pl&via=http%3A%2F%2Flocalhost%3A8079%2Flogout.jsf&callback=PIN_1530534339412.f.callback[0]", "Resource=0", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t84.inf", "Mode=HTML", LAST); web_add_cookie("dtPC=1$534334382_303h1p1$534338958_59h1vIFEDHEFBKIJNPMBFAJCMEPMMHECJNIBN; DOMAIN=localhost"); web_add_cookie("rxvt=1530536141947|1530534339061; DOMAIN=localhost"); web_add_cookie("dtSa=true%7CC%7C-1%7CClick%20here%20to%20return%20to%20the%20home%20page.%7C-%7C1530534341895%7C534338958_59%7Chttp%3A%2F%2Flocalhost%3A8079%2Flogout.jsf%7CeasyTravel%20-%20Logout%7C1530534339061%7C; DOMAIN=localhost"); addDynatraceHeaderTest("PC=localhost:8079_2;SI=LoadRunner;LSN=script name;"); web_url("localhost:8079_2", "URL=http://localhost:8079/", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t85.inf", "Mode=HTML", EXTRARES, "Url=http://assets.pinterest.com/js/pinit_main.js?0.08245911620938023", ENDITEM, LAST); addDynatraceHeaderTest("PC=rb_1_13;SI=LoadRunner;LSN=script name;"); web_custom_request("rb_1_13", "URL=http://localhost:8079/rb_1?type=js&session=1%2490732712A19CFE460D187D5D153DF84F%7CRUM%2BDefault%2BApplication%7C1&svrid=1&flavor=post&referer=http%3A%2F%2Flocalhost%3A8079%2Flogout.jsf&visitID=IFEDHEFBKIJNPMBFAJCMEPMMHECJNIBN", "Method=POST", "Resource=0", "RecContentType=text/plain", "Referer=http://localhost:8079/logout.jsf", "Snapshot=t86.inf", "Mode=HTML", "EncType=text/plain;charset=UTF-8", "Body=$a=d%7C-1%7CLogout%7CC%7C-%7C534334382_303%7C1530534338029%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange.jsf%7CeasyTravel%20-%20One%20step%20to%20happiness%2C1%7C1%7C_load_%7C_load_%7C-%7C1530534338242%7C0%7C124%7C-%7C-%7C-%7C-%7C-%7Chttp%3A%2F%2Flocalhost%3A8079%2Forange.jsf%2C2%7C3%7C_onload_%7C_load_%7C-%7C1530534340437%7C1530534340439%7C202$rId=RID_-838773383$rpId=-1669656246$domR=1530534340436$w=1920$h=1082$sw=1920$sh=1200$nt=" "a0b1530534338242c50d92e92f92g92h92i92k92l92m94n92o889p889q938r2194s2195t2197$V=1259|c$S=862$url=http%3A%2F%2Flocalhost%3A8079%2Flogout.jsf$title=easyTravel%20-%20Logout$vd=2884$isUnload=true$latC=53$visitID=IFEDHEFBKIJNPMBFAJCMEPMMHECJNIBN$fId=534338958_59$v=10150180628221724$vID=1530534276673RGLPOKT459A1LMBFO13616TBAI7S5Q2Q$time=1530534341947", LAST); addDynatraceHeaderTest("PC=widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_8;SI=LoadRunner;LSN=script name;"); web_url("widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html_8", "URL=https://platform.twitter.com/widgets/widget_iframe.bed9e19e565ca3b578705de9e73c29ed.html?origin=http%3A%2F%2Flocalhost%3A8079&settingsEndpoint=https%3A%2F%2Fsyndication.twitter.com%2Fsettings", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t87.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=fastbutton_8;SI=LoadRunner;LSN=script name;"); web_url("fastbutton_8", "URL=https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&origin=http%3A%2F%2Flocalhost%3A8079&url=http%3A%2F%2Fwww.dynatrace.com%2F&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t88.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=postmessageRelay_8;SI=LoadRunner;LSN=script name;"); web_url("postmessageRelay_8", "URL=https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Flocalhost%3A8079&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pl.de2wM28ILrc.O%2Fm%3D__features__%2Fam%3DwQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO5c-Kd6sZuD9hEQyRIuOc1MKFaQA", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t89.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_8;SI=LoadRunner;LSN=script name;"); web_url("follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html_8", "URL=https://platform.twitter.com/widgets/follow_button.bed9e19e565ca3b578705de9e73c29ed.en.html", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t90.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=xaOI6zd9HW9.js_9;SI=LoadRunner;LSN=script name;"); web_url("xaOI6zd9HW9.js_9", "URL=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t91.inf", "Mode=HTML", LAST); addDynatraceHeaderTest("PC=like.php_8;SI=LoadRunner;LSN=script name;"); web_url("like.php_8", "URL=https://www.facebook.com/plugins/like.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FxaOI6zd9HW9.js%3Fversion%3D42%23cb%3Df396528c7d57984%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%253A8079%252Ff853dcf6ad4ac4%26relation%3Dparent.parent&container_width=850&font=arial&href=http%3A%2F%2Flocalhost%3A8079%2Fwww.dynatrace.com&locale=en_US&sdk=joey&send=false&show_faces=false&width=300", "Resource=0", "RecContentType=text/html", "Referer=http://localhost:8079/", "Snapshot=t92.inf", "Mode=HTML", LAST); return 0; }
76.719274
512
0.787333
[ "render" ]
751eb6a78ede6d6a6474eba38d8c234d1a8f3bcd
11,660
h
C
openbabel-2.4.1/include/openbabel/math/vector3.h
sxhexe/reaction-route-search
f7694c84ca1def4a133ade3e1e2e09705cd28312
[ "MIT" ]
1
2017-09-16T07:36:29.000Z
2017-09-16T07:36:29.000Z
openbabel-2.4.1/include/openbabel/math/vector3.h
sxhexe/reaction-route-search
f7694c84ca1def4a133ade3e1e2e09705cd28312
[ "MIT" ]
null
null
null
openbabel-2.4.1/include/openbabel/math/vector3.h
sxhexe/reaction-route-search
f7694c84ca1def4a133ade3e1e2e09705cd28312
[ "MIT" ]
null
null
null
/********************************************************************** vector3.h - Handle 3D coordinates. Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc. Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison Some portions Copyright (C) 2006 by Benoit Jacob This file is part of the Open Babel project. For more information, see <http://openbabel.org/> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ #ifndef OB_VECTOR_H #define OB_VECTOR_H #include <ostream> #include <math.h> #include <iostream> #include <openbabel/rand.h> #ifndef RAD_TO_DEG #define RAD_TO_DEG (180.0/M_PI) #endif #ifndef DEG_TO_RAD #define DEG_TO_RAD (M_PI/180.0) #endif namespace OpenBabel { class matrix3x3; // declared in math/matrix3x3.h class OBRandom; // declared in rand.h // class introduction in vector3.cpp class OBAPI vector3 { private : double _vx, _vy, _vz ; public : //! Constructor vector3 (const double inX=0.0, const double inY=0.0, const double inZ=0.0): _vx(inX), _vy(inY), _vz(inZ) {} vector3 (double inV[3]): _vx(inV[0]), _vy(inV[1]), _vz(inV[2]) {} //! Copy Constructor vector3 (const vector3& v): _vx(v._vx), _vy(v._vy), _vz(v._vz) { } //! Destructor ~vector3() { } //! A random access iterator over x, y, z typedef double* iterator; //! A random access iterator over const x, y, z typedef const double* const_iterator; //! A signed integral type for differences between two iterators typedef std::ptrdiff_t difference_type; //! \return iterator to beginning iterator begin() { return &_vx; } //! \return iterator to end iterator end() { return &_vx + 3; } //! /return const_iterator to beginning const_iterator begin() const { return &_vx; } //! /return const_iterator to end const_iterator end() const { return &_vx + 3; } //! Set x,y and z-component of a vector void Set(const double inX, const double inY, const double inZ) { _vx = inX; _vy = inY; _vz = inZ; } //! Set x,y and z-component of a vector from c[0]..c[2] void Set(const double *c) { _vx = c[0]; _vy = c[1]; _vz = c[2]; } //! Access function to set the x-coordinate of the vector void SetX(const double inX) { _vx = inX; } //! Access function to set the y-coordinate of the vector void SetY(const double inY) { _vy = inY; } //! Access function to set the z-coordinate of the vector void SetZ(const double inZ) { _vz = inZ; } //! Access function to get the x-coordinate of the vector double GetX() const { return _vx; } //! Access function to get the y-coordinate of the vector double GetY() const { return _vy; } //! Access function to get the z-coordinate of the vector double GetZ() const { return _vz; } //! \brief Set c[0]..c[2] to the components of the vector //! \warning No error checking is performed void Get(double *c) { c[0]=_vx; c[1]=_vy; c[2]=_vz; } //! Access function to x: [0], y: [1], and z[2] double operator[] ( unsigned int i) const; //! Assignment vector3& operator= ( const vector3& v) { _vx = v._vx; _vy = v._vy; _vz = v._vz; return *this; } //! \return the vector as a const double * const double *AsArray() const { return &_vx; } //! \brief Vector addition (add @p v to *this) //! \return *this + v vector3& operator+= ( const vector3& v) { _vx += v._vx; _vy += v._vy; _vz += v._vz; return *this; }; //! \brief Vector subtraction (subtract @p v from *this) //! \return *this - v vector3& operator-= ( const vector3& v) { _vx -= v._vx; _vy -= v._vy; _vz -= v._vz; return *this; }; //! \brief Scalar addition (add @p f to *this) //! \return *this + f vector3& operator+= ( const double* f) { _vx += f[0]; _vy += f[1]; _vz += f[2]; return *this; }; //! \brief Scalar subtraction (subtract @p f from *this) //! \return *this - f vector3& operator-= ( const double* f) { _vx -= f[0]; _vy -= f[1]; _vz -= f[2]; return *this; }; //! \brief Scalar multiplication (multiply *this by @p c) //! \return *this * c vector3& operator*= ( const double& c) { _vx *= c; _vy *= c; _vz *= c; return *this; }; //! \brief Scalar division (divide *this by @p c) //! \return *this divided by c vector3& operator/= ( const double& c) { double inv = 1.0 / c; return( (*this) *= inv ); }; //! Multiplication of matrix and vector //! \return the result (i.e., the updated vector) //! \todo Currently unimplemented vector3& operator*= ( const matrix3x3 &); //! Create a random unit vector void randomUnitVector(OBRandom *oeRand= NULL); // Member Functions //! Scales a vector to give it length one. //! \return the result (i.e., the normalized vector) vector3& normalize () ; //! \return Whether a vector can be normalized bool CanBeNormalized () const; //! \return The length of the vector squared inline double length_2 () const { return _vx*_vx + _vy*_vy + _vz*_vz; }; //! \return The vector length double length () const { return sqrt( length_2() ); }; //! Access function to get the x-coordinate of the vector const double & x () const { return _vx ; } ; //! Access function to get the y-coordinate of the vector const double & y () const { return _vy ; } ; //! Access function to get the z-coordinate of the vector const double & z () const { return _vz ; } ; //! Access function to set the x-coordinate of the vector double & x () { return _vx ; } ; //! Access function to set the y-coordinate of the vector double & y () { return _vy ; } ; //! Access function to set the z-coordinate of the vector double & z () { return _vz ; } ; //! Comparison Methods // @{ //! \brief Equivalence of vectors //! \deprecated This method uses unreliable floating point == comparisons //! Use vector3::IsApprox() instead. //! \return true if every component is equal int operator== ( const vector3& ) const; //! \deprecated This method uses unreliable floating point == comparisons //! Use vector3::IsApprox() instead. //! \return true if at least one component of the two vectors is != int operator!= ( const vector3& other ) const { return ! ( (*this) == other ); } //! \brief Safe comparison for floating-point vector3 //! \return true if the vector *this is approximately equal to the vector //! @p other, to the precision @p precision. More specifically, //! this method works exactly like the OpenBabel::IsApprox() //! function, replacing the absolute value for doubles by the norm //! for vectors. //! \param other The vector for comparison //! \param precision This parameter plays the same role as in //! OpenBabel::IsApprox(). bool IsApprox( const vector3 & other, const double & precision ) const; //! }@ //! \return square of the distance between *this and vv /*! equivalent to length_2(*this-vv) */ double distSq(const vector3 &vv) const { double dx = x() - vv.x(); double dy = y() - vv.y(); double dz = z() - vv.z(); return( dx*dx + dy*dy + dz*dz ); } //! Creates a vector of length one, orthogonal to *this. //! \return Whether the method was successful bool createOrthoVector(vector3 &v) const; }; //! Prints a representation of the vector as a row vector of the form "<0.1,1,2>" OBAPI std::ostream& operator<< ( std::ostream&, const vector3& ); // Sum, Difference, Scalar Product //! Vector addition inline OBAPI vector3 operator+ ( const vector3& v1, const vector3& v2) { return vector3(v1.x()+v2.x(), v1.y()+v2.y(), v1.z()+v2.z()); } //! Vector subtraction inline OBAPI vector3 operator- ( const vector3& v1, const vector3& v2) { return vector3(v1.x()-v2.x(), v1.y()-v2.y(), v1.z()-v2.z()); } //! Unary minus inline OBAPI vector3 operator- ( const vector3& v) { return vector3(-v.x(), -v.y(), -v.z()); } //! Multiplication with a scalar inline OBAPI vector3 operator* ( const double& c, const vector3& v) { return vector3( c*v.x(), c*v.y(), c*v.z()); } //! Multiplication with a scalar inline OBAPI vector3 operator* ( const vector3& v, const double& c) { return vector3( c*v.x(), c*v.y(), c*v.z()); } //! Division by a scalar inline OBAPI vector3 operator/ ( const vector3& v, const double& c) { return vector3( v.x()/c, v.y()/c, v.z()/c); } // @removed@ misleading operation // friend vector3 operator* ( const vector3 &,const vector3 &); //vector and matrix ops // @removed@ misleading operation; matrix multiplication is not commutitative // friend vector3 operator *(const vector3 &v,const matrix3x3 &m); //! Multiplication of matrix and vector OBAPI vector3 operator *(const matrix3x3 &m, const vector3 &v); //! Dot product of two vectors inline OBAPI double dot ( const vector3& v1, const vector3& v2 ) { return v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z() ; } //! Cross product of two vectors OBAPI vector3 cross ( const vector3&, const vector3& ); //! Calculate the angle between vectors (in degrees) OBAPI double vectorAngle ( const vector3& v1, const vector3& v2 ); //! Calculate the torsion angle between vectors (in degrees) OBAPI double CalcTorsionAngle(const vector3 &a, const vector3 &b, const vector3 &c, const vector3 &d); //! Calculate the signed distance of point a to the plane determined by b,c,d OBAPI double Point2PlaneSigned(vector3 a, vector3 b, vector3 c, vector3 d); //! Calculate the distance of point a to the plane determined by b,c,d OBAPI double Point2Plane(vector3 a, vector3 b, vector3 c, vector3 d); //! Calculate the angle between point a and the plane determined by b,c,d OBAPI double Point2PlaneAngle(const vector3 a, const vector3 b, const vector3 c, const vector3 d); //! Calculate the distance of a point a to a line determined by b and c OBAPI double Point2Line(const vector3& a, const vector3& b, const vector3& c); // The global constant vector3 objects //! The zero vector: <0.0, 0.0, 0.0> extern OBAPI const vector3 VZero; //! The x unit vector: <1.0, 0.0, 0.0> extern OBAPI const vector3 VX; //! The y unit vector: <0.0, 1.0, 0.0> extern OBAPI const vector3 VY; //! The z unit vector: <0.0, 0.0, 1.0> extern OBAPI const vector3 VZ; } #endif // OB_VECTOR_H //! \file //! \brief Handle 3D coordinates.
29.444444
100
0.598199
[ "vector", "3d" ]
752475c2e5e410f1a5de704cec5dc6654c587e56
1,266
h
C
src/log4qt/helpers/binaryclasslogger.h
ztxc/Log4Qt
41c108535b6a0035e667c5a1a5d696c7adbd81c3
[ "Apache-2.0" ]
421
2015-12-22T15:13:26.000Z
2022-03-29T02:26:28.000Z
src/log4qt/helpers/binaryclasslogger.h
ztxc/Log4Qt
41c108535b6a0035e667c5a1a5d696c7adbd81c3
[ "Apache-2.0" ]
34
2016-05-09T17:32:38.000Z
2022-03-21T09:56:43.000Z
src/log4qt/helpers/binaryclasslogger.h
ztxc/Log4Qt
41c108535b6a0035e667c5a1a5d696c7adbd81c3
[ "Apache-2.0" ]
184
2016-01-15T08:43:16.000Z
2022-03-29T02:26:31.000Z
/****************************************************************************** * * This file is part of Log4Qt library. * * Copyright (C) 2007 - 2020 Log4Qt contributors * * 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 LOG4QT_BINARYCLASSLOGGER_H #define LOG4QT_BINARYCLASSLOGGER_H #include "log4qt/log4qtshared.h" #include <QAtomicPointer> class QObject; namespace Log4Qt { class Logger; class BinaryLogger; class LOG4QT_EXPORT BinaryClassLogger { public: BinaryClassLogger(); BinaryLogger *logger(const QObject *object); private: mutable QAtomicPointer<BinaryLogger> mLogger; }; } // namespace Log4Qt #endif // LOG4QT_BINARYCLASSLOGGER_H
26.375
80
0.658768
[ "object" ]
7524bcec3a0602497375e2a42e5fb67d6d6dabf4
20,505
h
C
Source/PluginEditor.h
vvvar/ggranula
45a2fb8c6d7a79c98ec87674e39065d56aa9d2db
[ "MIT" ]
null
null
null
Source/PluginEditor.h
vvvar/ggranula
45a2fb8c6d7a79c98ec87674e39065d56aa9d2db
[ "MIT" ]
null
null
null
Source/PluginEditor.h
vvvar/ggranula
45a2fb8c6d7a79c98ec87674e39065d56aa9d2db
[ "MIT" ]
null
null
null
/* ============================================================================== This file contains the basic framework code for a JUCE plugin editor. ============================================================================== */ #pragma once #include <JuceHeader.h> #include "PluginProcessor.h" //============================================================================== /** */ class GGranulaAudioProcessorEditor : public juce::AudioProcessorEditor, public juce::FileDragAndDropTarget { public: GGranulaAudioProcessorEditor (GGranulaAudioProcessor&); ~GGranulaAudioProcessorEditor() override; //============================================================================== void paint (juce::Graphics&) override; void resized() override; bool isInterestedInFileDrag (const StringArray& files) override; void filesDropped(const juce::StringArray& files, int x, int y) override; private: // This reference is provided as a quick way for your editor to // access the processor object that created it. GGranulaAudioProcessor& audioProcessor; //============================================================================== struct BaseComponent : public Component { using Colour = juce::Colour; using FontStyle = Font::FontStyleFlags; using Track = juce::Grid::TrackInfo; using Fr = juce::Grid::Fr; using Item = juce::GridItem; using Margin = juce::GridItem::Margin; using Justify = juce::GridItem::JustifySelf; using Align = juce::GridItem::AlignSelf; //============================================================================== BaseComponent(Colour background) : background_colour(background) {} //============================================================================== void paint (juce::Graphics& g) override { g.fillAll(background_colour); } void resized() override {} //============================================================================== struct PanelNameFont { const juce::String name { "Helvetica" }; float size { 15 }; Font::FontStyleFlags style { FontStyle::bold }; juce::Colour colour { juce::Colours::black }; }; struct ParameterLabelFont { const juce::String name { "Helvetica" }; float size { 13 }; Font::FontStyleFlags style { FontStyle::plain }; juce::Colour colour { juce::Colours::black }; }; //============================================================================== PanelNameFont getPanelNameFont () { return PanelNameFont(); } ParameterLabelFont getParameterLabelFont () { return ParameterLabelFont(); } //============================================================================== Colour background_colour; }; //============================================================================== struct TransposePanel : public BaseComponent, private juce::ComboBox::Listener { using TransposeChangeListener = std::function<void(const juce::String& transpose)>; //============================================================================== TransposePanel(juce::Colour background): BaseComponent(background), combo_box("transpose") { auto font = getParameterLabelFont(); label.setColour(juce::Label::ColourIds::textColourId, font.colour); label.setFont(Font(font.name, font.size, font.style)); addAndMakeVisible(label); combo_box.addItem("-2", 1); combo_box.addItem("-1", 2); combo_box.addItem("0", 3); combo_box.addItem("+1", 4); combo_box.addItem("+2", 5); combo_box.setSelectedId(3); combo_box.addListener(this); addAndMakeVisible(combo_box); } //============================================================================== void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (1)) }; grid.templateColumns = { Track (Fr (1)) }; grid.items = { Item(label), Item(combo_box), }; grid.performLayout(getLocalBounds()); } //============================================================================== void addListener(TransposeChangeListener listener) { listeners.push_back(listener); } //============================================================================== juce::ComboBox combo_box; juce::Label label { "transpose", "Transpose" }; private: std::list<TransposeChangeListener> listeners; //============================================================================== void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override { for (auto listener : listeners) { try { listener(comboBoxThatHasChanged->getText()); } catch (...) {} } } }; //============================================================================== struct WaveformPanel : public BaseComponent, private juce::ComboBox::Listener { using WaveformChangeListener = std::function<void(const juce::String& wavefrom)>; //============================================================================== WaveformPanel(juce::Colour background): BaseComponent(background), combo_box("waveform") { auto font = getParameterLabelFont(); label.setColour(juce::Label::ColourIds::textColourId, font.colour); label.setFont(Font(font.name, font.size, font.style)); addAndMakeVisible(label); combo_box.addItem("sin", 1); combo_box.addItem("saw", 2); combo_box.setSelectedId(1); combo_box.addListener(this); addAndMakeVisible(combo_box); } //============================================================================== void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (1)) }; grid.templateColumns = { Track (Fr (1)) }; grid.items = { Item(label), Item(combo_box), }; grid.performLayout(getLocalBounds()); } //============================================================================== void addListener(WaveformChangeListener listener) { listeners.push_back(listener); } //============================================================================== juce::ComboBox combo_box; juce::Label label { "waveform", "Waveform" }; private: std::list<WaveformChangeListener> listeners; //============================================================================== void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override { for (auto listener : listeners) { try { listener(comboBoxThatHasChanged->getText()); } catch (...) {} } } }; //============================================================================== struct OscillatorPanel : public BaseComponent { OscillatorPanel(juce::Colour background, const juce::String& label_text) : BaseComponent(background), label({}, label_text), transpose_panel(background), waveform_panel(background) { auto font = getParameterLabelFont(); label.setColour(juce::Label::ColourIds::textColourId, font.colour); label.setFont(Font(font.name, font.size, font.style)); addAndMakeVisible(label); addAndMakeVisible(transpose_panel); addAndMakeVisible(waveform_panel); } void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (2)) }; grid.templateColumns = { Track (Fr (1)), Track (Fr (1)) }; grid.items = { Item(label), Item(), Item(transpose_panel).withMargin(Margin(0, 50, 0, 0)), Item(waveform_panel).withMargin(Margin(0, 50, 0, 0)), }; grid.performLayout(getLocalBounds()); } juce::Label label; TransposePanel transpose_panel; WaveformPanel waveform_panel; }; //============================================================================== struct OscillatorsPanel : public BaseComponent { OscillatorsPanel(juce::Colour background) : BaseComponent(background), osc_1_panel(background, "OSC #1"), osc_2_panel(background, "OSC #2") { auto font = getPanelNameFont(); label.setColour(juce::Label::ColourIds::textColourId, font.colour); label.setFont(Font(font.name, font.size, font.style)); addAndMakeVisible(label); addAndMakeVisible(osc_1_panel); addAndMakeVisible(osc_2_panel); } void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (2)), Track (Fr (2)) }; grid.templateColumns = { Track (Fr (1)) }; grid.items = { Item(label).withMargin(10), Item(osc_1_panel).withMargin(10), Item(osc_2_panel).withMargin(10) }; grid.performLayout(getLocalBounds()); } juce::Label label { "oscillators", "Oscillators" }; OscillatorPanel osc_1_panel; OscillatorPanel osc_2_panel; }; //============================================================================== struct CutoffPanel : public BaseComponent, private juce::Slider::Listener { using CutoffListener = std::function<void(double)>; //============================================================================== CutoffPanel (juce::Colour background) : BaseComponent(background), cutoff("Cutoff") { cutoff.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); cutoff.setTextBoxStyle(juce::Slider::TextBoxBelow, true, 50.0f, 20.0f); cutoff.setSkewFactor(0.25f); cutoff.setRange(Range<double>(10.0f, 16000.0f), 1.0f); cutoff.addListener(this); addAndMakeVisible(cutoff); } //============================================================================== void resized () override { juce::Grid grid; grid.templateRows = { Track (Fr (1)) }; grid.templateColumns = { Track (Fr (1)) }; grid.items = { Item(cutoff) }; grid.performLayout(getLocalBounds()); } void addListener (CutoffListener listener) { listeners.push_back(listener); } //============================================================================== juce::Slider cutoff; private: std::list<CutoffListener> listeners; //============================================================================== void sliderValueChanged (Slider* slider) override { for (auto listener : listeners) { try { listener(slider->getValue()); } catch (...) {} } } }; //============================================================================== struct FilterPanel : public BaseComponent { FilterPanel(juce::Colour background) : BaseComponent(background), cutoff_panel(background) { auto font = getPanelNameFont(); label.setColour(juce::Label::ColourIds::textColourId, font.colour); label.setFont(Font(font.name, font.size, font.style)); addAndMakeVisible(label); addAndMakeVisible(cutoff_panel); q.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); q.setTextBoxStyle(juce::Slider::TextBoxRight, true, 35.0f, 20.0f); q.setSkewFactor(0.5f); q.setRange(Range<double>(0.1f, 1.2f), 0.1f); addAndMakeVisible(q); } void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (2)) }; grid.templateColumns = { Track (Fr (1)), Track (Fr (1)) }; grid.items = { Item(label).withMargin(8), Item(), Item(cutoff_panel), Item(q).withMargin(Margin(0, 20, 0, 0)) }; grid.performLayout(getLocalBounds()); } juce::Label label { "filter", "Filter" }; CutoffPanel cutoff_panel; juce::Slider q { "q" }; }; //============================================================================== struct ADSRPanel : public BaseComponent { ADSRPanel(juce::Colour background) : BaseComponent(background) { attack.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); attack.setTextBoxStyle(juce::Slider::TextBoxRight, true, 30, 16); attack.setNormalisableRange(juce::NormalisableRange<double>(0.01f, 10.0f, 0.01f, 0.5f)); addAndMakeVisible(attack); decay.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); decay.setTextBoxStyle(juce::Slider::TextBoxRight, true, 30, 16); decay.setNormalisableRange(juce::NormalisableRange<double>(0.01f, 10.0f, 0.01f, 0.5f)); addAndMakeVisible(decay); sustain.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); sustain.setTextBoxStyle(juce::Slider::TextBoxRight, true, 30, 16); sustain.setNormalisableRange(juce::NormalisableRange<double>(0.01f, 10.0f, 0.01f, 0.5f)); addAndMakeVisible(sustain); release.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); release.setTextBoxStyle(juce::Slider::TextBoxRight, true, 30, 16); release.setNormalisableRange(juce::NormalisableRange<double>(0.01f, 20.0f, 0.01f, 0.5f)); addAndMakeVisible(release); } void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)) }; grid.templateColumns = { Track (Fr (1)), Track (Fr (1)), Track (Fr (1)), Track (Fr (1)) }; grid.items = { Item(attack), Item(decay), Item(sustain), Item(release) }; grid.performLayout(getLocalBounds()); } juce::Slider attack { "attack" }; juce::Slider decay { "decay" }; juce::Slider sustain { "sustain" }; juce::Slider release { "release" }; }; //============================================================================== struct AmpPanel : public BaseComponent { AmpPanel(juce::Colour background) : BaseComponent(background), amp_panel(background) { auto font = getPanelNameFont(); label.setColour(juce::Label::ColourIds::textColourId, font.colour); label.setFont(Font(font.name, font.size, font.style)); addAndMakeVisible(label); addAndMakeVisible(amp_panel); } void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (2)) }; grid.templateColumns = { Track (Fr (1)) }; grid.items = { Item(label).withMargin(8), Item(amp_panel) }; grid.performLayout(getLocalBounds()); } juce::Label label { "amp", "AMP" }; ADSRPanel amp_panel; }; //============================================================================== struct FilterAmpPanel : public BaseComponent { FilterAmpPanel(juce::Colour filter_background, juce::Colour adsr_background) : BaseComponent(filter_background), filter_panel(filter_background), amp_panel(adsr_background) { addAndMakeVisible(filter_panel); addAndMakeVisible(amp_panel); } void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)), Track (Fr (1)) }; grid.templateColumns = { Track (Fr (1)), }; grid.items = { Item(filter_panel), Item(amp_panel) }; grid.performLayout(getLocalBounds()); } FilterPanel filter_panel; AmpPanel amp_panel; }; //============================================================================== struct MainPanel : public BaseComponent { MainPanel() : BaseComponent(juce::Colours::grey), osc_panel(juce::Colours::silver), filter_adsr_panel(juce::Colours::silver, juce::Colours::silver) { addAndMakeVisible(osc_panel); addAndMakeVisible(filter_adsr_panel); } //============================================================================== void resized() override { juce::Grid grid; grid.templateRows = { Track (Fr (1)) }; grid.templateColumns = { Track (Fr (1)), Track (Fr (1)) }; grid.items = { Item(osc_panel).withMargin(10), Item(filter_adsr_panel).withMargin(10) }; grid.performLayout (getLocalBounds()); } //============================================================================== using TransposeChangeListener = std::function<void(const juce::String& transpose)>; using WaveformChangeListener = std::function<void(const juce::String& wavefrom)>; using CutoffListener = std::function<void(double)>; void addOSC1TransposeListener(TransposeChangeListener listener) { osc_panel.osc_1_panel.transpose_panel.addListener(listener); } void addOSC1WaveformListener(WaveformChangeListener listener) { osc_panel.osc_1_panel.waveform_panel.addListener(listener); } void addOSC2TransposeListener(TransposeChangeListener listener) { osc_panel.osc_2_panel.transpose_panel.addListener(listener); } void addOSC2WaveformListener(WaveformChangeListener listener) { osc_panel.osc_2_panel.waveform_panel.addListener(listener); } void addCutoffListener(CutoffListener listener) { filter_adsr_panel.filter_panel.cutoff_panel.addListener(listener); } //============================================================================== OscillatorsPanel osc_panel; FilterAmpPanel filter_adsr_panel; }; //============================================================================== MainPanel main_panel; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GGranulaAudioProcessorEditor) };
38.615819
102
0.45662
[ "object" ]
7530295b8e4cb2cf7d47e4abb8905ae27cabdd5c
3,017
h
C
Pods/Headers/Public/ComponentKit/CKIndexTransform.h
zyfu0000/AsyncApplicationKit
4af50fad6bd9d88709c85efc8ca14113d4fc9117
[ "MIT" ]
null
null
null
Pods/Headers/Public/ComponentKit/CKIndexTransform.h
zyfu0000/AsyncApplicationKit
4af50fad6bd9d88709c85efc8ca14113d4fc9117
[ "MIT" ]
null
null
null
Pods/Headers/Public/ComponentKit/CKIndexTransform.h
zyfu0000/AsyncApplicationKit
4af50fad6bd9d88709c85efc8ca14113d4fc9117
[ "MIT" ]
null
null
null
// Copyright 2004-present Facebook. All Rights Reserved. #import <ComponentKit/CKDefines.h> #if CK_NOT_SWIFT #import <vector> #import <Foundation/NSIndexSet.h> #import <Foundation/NSRange.h> namespace CK { struct IndexTransform final { explicit IndexTransform(NSIndexSet *indexes); auto applyOffsetToIndex(NSInteger index) const -> NSInteger; auto findRangeAndApplyOffsetToIndex(NSInteger index) const -> NSInteger; private: struct RangeOffset { NSRange range; NSInteger offset; }; std::vector<RangeOffset> _rangeOffsets; }; struct RemovalIndexTransform final { explicit RemovalIndexTransform(NSIndexSet *indexes) : _t(indexes) {}; /** Given an item index before applying a transform, returns a new index of the same item. For example, given a transform created with indexes `{0, 1}` and an input index of 2, this method will return 0 since there were two items removed before index 2. @param index Item index before applying the trasform. @return Item index after the transform is applied, or `NSNotFound` if the item is no longer present after applying the transform. */ auto applyToIndex(NSInteger index) const -> NSInteger { return _t.applyOffsetToIndex(index); } /** Given an item index after applying the transform, returns an index the same item had before application. For example, given a transform created with indexes `{0, 1}` and an input index of 0, this method will return 2 since there were two items previously before index 0. @param index Item index after applying the transform. @return Item index before the transform was applied. This method never returns `NSNotFound`. */ auto applyInverseToIndex(NSInteger index) const -> NSInteger { return _t.findRangeAndApplyOffsetToIndex(index); } private: IndexTransform _t; }; struct InsertionIndexTransform final { explicit InsertionIndexTransform(NSIndexSet *indexes) : _t(indexes) {}; auto applyToIndex(NSInteger index) const -> NSInteger { return _t.findRangeAndApplyOffsetToIndex(index); } auto applyInverseToIndex(NSInteger index) const -> NSInteger { return _t.applyOffsetToIndex(index); } private: IndexTransform _t; }; template <typename T1, typename T2> struct CompositeIndexTransform final { CompositeIndexTransform(T1 &&t1, T2 &&t2) : _t1(std::forward<T1>(t1)), _t2(std::forward<T2>(t2)) {} auto applyToIndex(NSInteger index) const -> NSInteger { auto const i = _t1.applyToIndex(index); return i != NSNotFound ? _t2.applyToIndex(i) : NSNotFound; } auto applyInverseToIndex(NSInteger index) const -> NSInteger { return _t2.applyInverseToIndex(_t1.applyInverseToIndex(index)); } private: T1 _t1; T2 _t2; }; template <typename T1, typename T2> static auto makeCompositeIndexTransform(T1 &&t1, T2 &&t2) { return CompositeIndexTransform<T1, T2>(std::forward<T1>(t1), std::forward<T2>(t2)); } } #endif
32.44086
132
0.717269
[ "vector", "transform" ]
7534c9dc432f0b85111674c8a4a08ea1e79b1924
6,342
h
C
source/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.h
binaryblob01/zfree86
e80ea992d87501b8e3e2d7c07a414591c2e11c70
[ "Xnet", "X11" ]
1
2021-09-08T21:13:25.000Z
2021-09-08T21:13:25.000Z
source/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.h
binaryblob01/zfree86
e80ea992d87501b8e3e2d7c07a414591c2e11c70
[ "Xnet", "X11" ]
null
null
null
source/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.h
binaryblob01/zfree86
e80ea992d87501b8e3e2d7c07a414591c2e11c70
[ "Xnet", "X11" ]
1
2021-01-22T00:19:47.000Z
2021-01-22T00:19:47.000Z
/* * Acceleration for the Creator and Creator3D framebuffer - Accel func declarations. * * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) * Copyright (C) 1998 Michal Rehacek (majkl@iname.com) * Copyright (C) 1999 David S. Miller (davem@redhat.com) * * 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 * JAKUB JELINEK, MICHAL REHACEK, OR DAVID MILLER 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. * */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.h,v 1.3 2004/12/05 23:06:37 tsi Exp $ */ #ifndef FFBGC_H #define FFBGC_H extern Bool CreatorCreateGC(GCPtr pGC); extern void CreatorDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask); extern void CreatorDoVertBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask); extern RegionPtr CreatorCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty); extern RegionPtr CreatorCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane); extern void CreatorFillBoxSolid(DrawablePtr pDrawable, int nBox, BoxPtr pBox, unsigned long pixel); extern void CreatorFillBoxStipple(DrawablePtr pDrawable, int nBox, BoxPtr pBox, CreatorStipplePtr stipple); extern void CreatorPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit); extern void CreatorFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted); extern void CreatorPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, xPoint *pptInit); extern void CreatorPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg); extern void CreatorFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr ppt); extern void CreatorPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); extern void CreatorPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); extern void CreatorTEGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); extern void CreatorPolyTEGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); extern void CreatorPolyFillArcSolid(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); extern void CreatorZeroPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); extern int CreatorCheckTile(PixmapPtr pPixmap, CreatorStipplePtr stipple, int ox, int oy, int ph); extern int CreatorCheckStipple(PixmapPtr pPixmap, CreatorStipplePtr stipple, int ox, int oy, int ph); extern int CreatorCheckLinePattern(GCPtr pGC, CreatorPrivGCPtr gcPriv); extern int CreatorCheckFill(GCPtr pGC, DrawablePtr pDrawable); extern void CreatorSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pcharsrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); /* Stuff still not accelerated fully. */ extern void CreatorSegmentSSStub(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg); extern void CreatorLineSSStub(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); extern void CreatorSegmentSDStub(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg); extern void CreatorLineSDStub(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); extern void CreatorSolidSpansGeneralStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void CreatorPolyGlyphBlt8Stub(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); extern void CreatorImageGlyphBlt8Stub(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); extern void CreatorTile32FSCopyStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void CreatorTile32FSGeneralStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void CreatorUnnaturalTileFSStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void Creator8Stipple32FSStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void CreatorUnnaturalStippleFSStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void Creator8OpaqueStipple32FSStub(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); extern void CreatorPolyFillRectStub(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit); #endif /* FFBGC_H */
38.436364
106
0.744402
[ "shape" ]
75396365f3707b02052827bd9b73a63736c298ae
2,362
h
C
src_tmpl.h
CatherineMeng/FPGA-Accelerated-Frationally-Strided-Convolution
5dff1449fb669657db58d4192a46d9793531eaaf
[ "MIT" ]
5
2021-07-17T06:17:52.000Z
2021-08-30T00:18:14.000Z
src_tmpl.h
CatherineMeng/FPGA-Accelerated-Frationally-Strided-Convolution
5dff1449fb669657db58d4192a46d9793531eaaf
[ "MIT" ]
null
null
null
src_tmpl.h
CatherineMeng/FPGA-Accelerated-Frationally-Strided-Convolution
5dff1449fb669657db58d4192a46d9793531eaaf
[ "MIT" ]
null
null
null
#include "hls_stream.h" #include "ap_int.h" // #include "hls_math.h" #include <iostream> #include <iomanip> #include <vector> extern "C"{ using namespace std; typedef ap_uint<8> dinA_t; typedef ap_int<16> dout_t; //MM:In(o^2,Cout)*W(Cout,Cin)** K^2 #define BSIZE 1 #define cci 64 #define ccin (BSIZE*cci) const int K = 5; const int S = 2; #define H 20 //fix it as the largest H needed to define scratchpad size[H=(i)+K-1] const int O2 = 64; //make it multiple of Pa ((H-K)/S+1)^2 9*9=81->88, 49->56, 1->4(FC) const int O = 8; const int Cout =256; const int Cin = ccin; //if multiple SLRs, divide by the number of SLRs //Fill in any subsequent layers //layer n: // #define cci 64 // #define ccin (BSIZE*cci) // const int K = 3; // const int S = 1; // #define H 12; // const int O2 = 52; //((H-K)/S+1)^2 49->52, 1->4(FC) // const int Cout =32; // const int Cin = ccin; //hardware parameters // # PxT SAs #define P 16 #define T 16 #define n 2 // # adders in pad-acc #define L 32 const int k_bound=(K*K % n) ? K*K/n + 1 : K*K/n; //Fifo Aggregation size (for float: typically needs to be larger than P,T for best intereval hiding) //(for int: Pa, Ta = P,T) #define Pa 32 #define Ta 16 typedef struct { dout_t a[Pa]; } blockvec_In_P; // same for out typedef struct { int a[Pa]; } blockvec_Out_P; typedef struct { dout_t a[Ta]; } blockvec_W_T; void loadIn(blockvec_In_P In[], hls::stream<blockvec_In_P> &Inrows,const int o2,const int co, int it1); void InBroadcast(hls::stream<blockvec_In_P> &Inrows,hls::stream<blockvec_In_P> Outrows[n],const int co); void loadW(blockvec_W_T W[], blockvec_W_T Wcols[], const int ci,const int co,int it2,int itk); void matmulcore(hls::stream<blockvec_In_P> &Inrows, blockvec_W_T Wcols[], hls::stream<blockvec_Out_P> &Crows,const int co); void padacc(hls::stream<blockvec_Out_P> Inrows[n],const int S,const int K,const int O,int it1,int it2,int itk,hls::stream<blockvec_Out_P> &outpipe); void storeDDR(blockvec_Out_P C[], hls::stream<blockvec_Out_P> &outpipe, int it1,int it2); // B_n are the weight interfaces. Customize based on n void sstage1_3(blockvec_In_P *A, blockvec_W_T *B1, blockvec_W_T *B2, int it2,hls::stream<blockvec_Out_P> &outpipe); void top(blockvec_In_P *A, blockvec_W_T *B1, blockvec_W_T *B2, blockvec_Out_P *C); }
29.525
149
0.676122
[ "vector" ]
753f9febd6abd5df8e4e354f991103af73e7f0f7
8,980
c
C
raja/halos.c
UoB-HPC/arch
f19d9325d993bd31fc348b648db8dc49b77593d7
[ "MIT" ]
1
2021-03-16T06:23:37.000Z
2021-03-16T06:23:37.000Z
raja/halos.c
UoB-HPC/arch
f19d9325d993bd31fc348b648db8dc49b77593d7
[ "MIT" ]
null
null
null
raja/halos.c
UoB-HPC/arch
f19d9325d993bd31fc348b648db8dc49b77593d7
[ "MIT" ]
1
2019-11-25T06:52:10.000Z
2019-11-25T06:52:10.000Z
#include "../comms.h" #include "../mesh.h" #include "../umesh.h" #include "shared.h" // Enforce reflective boundary conditions on the problem state void handle_boundary_2d(const int nx, const int ny, Mesh* mesh, double* arr, const int invert, const int pack) { START_PROFILING(&comms_profile); const int pad = mesh->pad; int* neighbours = mesh->neighbours; #ifdef MPI int nmessages = 0; if (pack) { // Pack east and west if (neighbours[EAST] != EDGE) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, ny-pad), [=] RAJA_DEVICE (int ii) { for (int dd = 0; dd < pad; ++dd) { mesh->east_buffer_out[(ii - pad) * pad + dd] = arr[(ii * nx) + (nx - 2 * pad + dd)]; } }); non_block_send(mesh->east_buffer_out, (ny - 2 * pad) * pad, neighbours[EAST], 2, nmessages++); non_block_recv(mesh->east_buffer_in, (ny - 2 * pad) * pad, neighbours[EAST], 3, nmessages++); } if (neighbours[WEST] != EDGE) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, ny-pad), [=] RAJA_DEVICE (int ii) { for (int dd = 0; dd < pad; ++dd) { mesh->west_buffer_out[(ii - pad) * pad + dd] = arr[(ii * nx) + (pad + dd)]; } }); non_block_send(mesh->west_buffer_out, (ny - 2 * pad) * pad, neighbours[WEST], 3, nmessages++); non_block_recv(mesh->west_buffer_in, (ny - 2 * pad) * pad, neighbours[WEST], 2, nmessages++); } // Pack north and south if (neighbours[NORTH] != EDGE) { for (int dd = 0; dd < pad; ++dd) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, nx-pad), [=] RAJA_DEVICE (int jj) { mesh->north_buffer_out[dd * (nx - 2 * pad) + (jj - pad)] = arr[(ny - 2 * pad + dd) * nx + jj]; }); } non_block_send(mesh->north_buffer_out, (nx - 2 * pad) * pad, neighbours[NORTH], 1, nmessages++); non_block_recv(mesh->north_buffer_in, (nx - 2 * pad) * pad, neighbours[NORTH], 0, nmessages++); } if (neighbours[SOUTH] != EDGE) { for (int dd = 0; dd < pad; ++dd) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, nx-pad), [=] RAJA_DEVICE (int jj) { mesh->south_buffer_out[dd * (nx - 2 * pad) + (jj - pad)] = arr[(pad + dd) * nx + jj]; }); } non_block_send(mesh->south_buffer_out, (nx - 2 * pad) * pad, neighbours[SOUTH], 0, nmessages++); non_block_recv(mesh->south_buffer_in, (nx - 2 * pad) * pad, neighbours[SOUTH], 1, nmessages++); } wait_on_messages(nmessages); // Unpack east and west if (neighbours[WEST] != EDGE) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, ny-pad), [=] RAJA_DEVICE (int ii) { for (int dd = 0; dd < pad; ++dd) { arr[ii * nx + dd] = mesh->west_buffer_in[(ii - pad) * pad + dd]; } }); } if (neighbours[EAST] != EDGE) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, ny-pad), [=] RAJA_DEVICE (int ii) { for (int dd = 0; dd < pad; ++dd) { arr[ii * nx + (nx - pad + dd)] = mesh->east_buffer_in[(ii - pad) * pad + dd]; } }); } // Unpack north and south if (neighbours[NORTH] != EDGE) { for (int dd = 0; dd < pad; ++dd) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, nx-pad), [=] RAJA_DEVICE (int jj) { arr[(ny - pad + dd) * nx + jj] = mesh->north_buffer_in[dd * (nx - 2 * pad) + (jj - pad)]; }); } } if (neighbours[SOUTH] != EDGE) { for (int dd = 0; dd < pad; ++dd) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, nx-pad), [=] RAJA_DEVICE (int jj) { arr[dd * nx + jj] = mesh->south_buffer_in[dd * (nx - 2 * pad) + (jj - pad)]; }); } } } #endif // Perform the boundary reflections, potentially with the data updated from // neighbours double x_inversion_coeff = (invert == INVERT_X) ? -1.0 : 1.0; double y_inversion_coeff = (invert == INVERT_Y) ? -1.0 : 1.0; // Reflect at the north if (neighbours[NORTH] == EDGE) { for (int dd = 0; dd < pad; ++dd) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, nx-pad), [=] RAJA_DEVICE (int jj) { arr[(ny - pad + dd) * nx + jj] = y_inversion_coeff * arr[(ny - 1 - pad - dd) * nx + jj]; }); } } // reflect at the south if (neighbours[SOUTH] == EDGE) { for (int dd = 0; dd < pad; ++dd) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, nx-pad), [=] RAJA_DEVICE (int jj) { arr[(pad - 1 - dd) * nx + jj] = y_inversion_coeff * arr[(pad + dd) * nx + jj]; }); } } // reflect at the east if (neighbours[EAST] == EDGE) { RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, ny-pad), [=] RAJA_DEVICE (int ii) { for (int dd = 0; dd < pad; ++dd) { arr[ii * nx + (nx - pad + dd)] = x_inversion_coeff * arr[ii * nx + (nx - 1 - pad - dd)]; } }); } if (neighbours[WEST] == EDGE) { // reflect at the west RAJA::forall<exec_policy>(RAJA::RangeSegment(pad, ny-pad), [=] RAJA_DEVICE (int ii) { for (int dd = 0; dd < pad; ++dd) { arr[ii * nx + (pad - 1 - dd)] = x_inversion_coeff * arr[ii * nx + (pad + dd)]; } }); } STOP_PROFILING(&comms_profile, __func__); } // Enforce reflective boundary conditions on the problem state void handle_boundary_3d(const int nx, const int ny, const int nz, Mesh* mesh, double* arr, const int invert, const int pack) { TERMINATE("Not implemented\n"); } // Reflect the node centered velocities on the boundary void handle_unstructured_reflect(const int nnodes, const int* boundary_index, const int* boundary_type, const double* boundary_normal_x, const double* boundary_normal_y, double* velocity_x, double* velocity_y) { RAJA::forall<exec_policy>(RAJA::RangeSegment(0, nnodes), [=] RAJA_DEVICE (int nn) { const int index = boundary_index[(nn)]; if (index != IS_INTERIOR) { if (boundary_type[(index)] == IS_BOUNDARY) { // Project the velocity onto the face direction const double boundary_parallel_x = boundary_normal_y[(index)]; const double boundary_parallel_y = -boundary_normal_x[(index)]; const double vel_dot_parallel = (velocity_x[(nn)] * boundary_parallel_x + velocity_y[(nn)] * boundary_parallel_y); velocity_x[(nn)] = boundary_parallel_x * vel_dot_parallel; velocity_y[(nn)] = boundary_parallel_y * vel_dot_parallel; } else if (boundary_type[(index)] == IS_CORNER) { velocity_x[(nn)] = 0.0; velocity_y[(nn)] = 0.0; } } }); } // Reflect the node centered velocities on the boundary void handle_unstructured_reflect_3d(const int nnodes, const int* boundary_index, const int* boundary_type, const double* boundary_normal_x, const double* boundary_normal_y, const double* boundary_normal_z, double* velocity_x, double* velocity_y, double* velocity_z) { RAJA::forall<exec_policy>(RAJA::RangeSegment(0, nnodes), [=] RAJA_DEVICE (int nn) { const int index = boundary_index[(nn)]; if (index != IS_INTERIOR) { if (boundary_type[(index)] == IS_EDGE) { // The normal here isn't actually a normal but a projection vector const double ab = (velocity_x[(nn)] * boundary_normal_x[(index)] + velocity_y[(nn)] * boundary_normal_y[(index)] + velocity_z[(nn)] * boundary_normal_z[(index)]); // Project the vector onto the edge line velocity_x[(nn)] = ab * boundary_normal_x[(index)]; velocity_y[(nn)] = ab * boundary_normal_y[(index)]; velocity_z[(nn)] = ab * boundary_normal_z[(index)]; } else if (boundary_type[(index)] == IS_BOUNDARY) { // Perform an orthogonal projection, assuming normal vector is normalised const double un = (velocity_x[(nn)] * boundary_normal_x[(index)] + velocity_y[(nn)] * boundary_normal_y[(index)] + velocity_z[(nn)] * boundary_normal_z[(index)]); velocity_x[(nn)] -= un * boundary_normal_x[(index)]; velocity_y[(nn)] -= un * boundary_normal_y[(index)]; velocity_z[(nn)] -= un * boundary_normal_z[(index)]; } else if (boundary_type[(index)] == IS_CORNER) { velocity_x[(nn)] = 0.0; velocity_y[(nn)] = 0.0; velocity_z[(nn)] = 0.0; } } }); }
38.540773
93
0.543653
[ "mesh", "vector" ]
7541f61e18604a3de98445409233a894eb953b9b
8,620
h
C
simulation.h
franchetti/neural-net
85750c957f35866f1c2a2cfe754d8e06a8c05add
[ "MIT" ]
null
null
null
simulation.h
franchetti/neural-net
85750c957f35866f1c2a2cfe754d8e06a8c05add
[ "MIT" ]
null
null
null
simulation.h
franchetti/neural-net
85750c957f35866f1c2a2cfe754d8e06a8c05add
[ "MIT" ]
null
null
null
#pragma once SDL_Texture* car_texture = NULL; class Simulation { float last_angle = 275; vector<pair<SDL_Point, float>> road; SDL_Point car_position; float car_velocity = 5; float car_angle = 0; float car_max_velocity = 5; float car_max_angle = 30; vector<pair<pair<float,float>, float>> car_sensor_angles = { pair<pair<float,float>,float>(pair<float,float>(0,45),0) , pair<pair<float,float>,float>(pair<float,float>(15,45),0), pair<pair<float,float>,float>(pair<float,float>(-15,45),0), pair<pair<float,float>,float>(pair<float,float>(45,45),0), pair<pair<float,float>,float>(pair<float,float>(-45,45),0), pair<pair<float,float>,float>(pair<float,float>(75,45),0), pair<pair<float,float>,float>(pair<float,float>(-75,45),0), }; public: bool car_crashed = false; Simulation(string path, SDL_Renderer* renderer) { if (car_texture == NULL) { //Load image at specified path SDL_Surface* loadedSurface = IMG_Load(path.c_str()); if (loadedSurface == NULL) { printf("Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError()); } else { SDL_SetColorKey(loadedSurface, SDL_TRUE, SDL_MapRGB(loadedSurface->format, 0xFF, 0xFF, 0xFF)); //Create texture from surface pixels car_texture = SDL_CreateTextureFromSurface(renderer, loadedSurface); if (car_texture == NULL) { printf("Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError()); } //Get rid of old loaded surface SDL_FreeSurface(loadedSurface); } } generate_road(); } void generate_road(); void draw(SDL_Rect area, SDL_Renderer* renderer, double zoom); float run(NeuralNet* net); }; void Simulation::generate_road() { if (road.size() == 0) { SDL_Point start; start.x = 0; start.y = 0; road.push_back(pair<SDL_Point, float>(start, 50)); } float angle = Random::random_value(last_angle-15, last_angle+15); if (angle > 360)angle -= 360; if (angle < -360)angle += 360; last_angle = angle; float distance = Random::random_value(10, 30); SDL_Point new_road; new_road.x = road[road.size() - 1].first.x + cos(to_rad(angle))*distance; new_road.y = road[road.size() - 1].first.y + sin(to_rad(angle))*distance; float width = Random::random_value(road[road.size() - 1].second-2.5, road[road.size() - 1].second+2.5); if (width < 20)width = 20; if (width > 45)width = 45; road.push_back(pair<SDL_Point, float>(new_road,width)); if (road.size() > 25) { road.erase(road.begin()); } } void Simulation::draw(SDL_Rect area, SDL_Renderer* renderer, double zoom) { writeTxt("Car velocity: " + to_string(car_velocity), 10, 5, 100, 25, 0, renderer); writeTxt("Car angle: " + to_string(car_angle), 10, 30, 100, 25, 0, renderer); SDL_Point center = car_position; SDL_RenderDrawLine(renderer, 0 - center.x*zoom + area.w / 2, -10000 - center.x*zoom + area.w / 2, 0 - center.x*zoom + area.w / 2, 10000 - center.x*zoom + area.w / 2); SDL_RenderDrawLine(renderer, -10000 - center.x*zoom + area.w / 2, 0 - center.x*zoom + area.w / 2, 10000 - center.x*zoom + area.w / 2, 0 - center.x*zoom + area.w / 2); float angle = angular_coefficient(road[1].first, road[0].first); SDL_Point a; a.x = road[0].first.x + sqrt(pow(road[0].second, 2) / (1 + 1 / pow(angle, 2))); a.y = -1 / angle*(a.x - road[0].first.x) + road[0].first.y; SDL_Point b; b.x = road[0].first.x - sqrt(pow(road[0].second, 2) / (1 + 1 / pow(angle, 2))); b.y = -1 / angle*(b.x - road[0].first.x) + road[0].first.y; for (int r = 1; r < road.size(); r++) { float angle = angular_coefficient(road[r].first, road[r-1].first); SDL_Point a1; a1.x = road[r].first.x + sqrt(pow(road[r].second, 2) / (1 + 1 / pow(angle, 2))); a1.y = -1 / angle*(a1.x - road[r].first.x) + road[r].first.y; SDL_Point b1; b1.x = road[r].first.x - sqrt(pow(road[r].second, 2) / (1 + 1 / pow(angle, 2))); b1.y = -1 / angle*(b1.x - road[r].first.x) + road[r].first.y; SDL_RenderDrawLine(renderer, a.x*zoom - center.x*zoom + area.w / 2, a.y*zoom - center.y*zoom + area.h / 2, a1.x*zoom - center.x*zoom + area.w / 2, a1.y*zoom - center.y*zoom + area.h / 2); SDL_RenderDrawLine(renderer, b.x*zoom - center.x*zoom + area.w / 2, b.y*zoom - center.y*zoom + area.h / 2, b1.x*zoom - center.x*zoom + area.w / 2, b1.y*zoom - center.y*zoom + area.h / 2); SDL_RenderDrawLine(renderer, road[r].first.x*zoom - center.x*zoom + area.w / 2, road[r].first.y*zoom - center.y*zoom + area.h / 2, road[r-1].first.x*zoom - center.x*zoom + area.w / 2, road[r-1].first.y*zoom - center.y*zoom + area.h / 2); a = a1; b = b1; } SDL_Rect car1; car1.w = 20*zoom; car1.h = 20*zoom; car1.x = (car_position.x - car1.w/zoom / 2)*zoom - center.x*zoom + area.w / 2; car1.y = (car_position.y - car1.h/zoom / 2)*zoom - center.y*zoom + area.h / 2; SDL_RenderCopyEx(renderer, car_texture, NULL, &car1, car_angle, NULL, SDL_FLIP_NONE); for (auto s : car_sensor_angles) { SDL_RenderDrawLine(renderer, car_position.x*zoom - center.x*zoom + area.w / 2, car_position.y*zoom - center.y*zoom + area.h / 2, car_position.x* zoom+ cos(to_rad(car_angle + s.first.first-90))*s.first.second*zoom - center.x*zoom + area.w / 2, car_position.y*zoom + sin(to_rad(car_angle + s.first.first-90))*s.first.second*zoom - center.y*zoom + area.h / 2); if (s.second != 0) { SDL_Rect sensor = { car_position.x* zoom + cos(to_rad(car_angle + s.first.first - 90))*s.first.second*zoom - center.x*zoom + area.w / 2-3*zoom, car_position.y*zoom + sin(to_rad(car_angle + s.first.first - 90))*s.first.second*zoom - center.y*zoom + area.h / 2-3*zoom, 6*zoom, 6*zoom}; SDL_SetRenderDrawColor(renderer, 255, 0, 0, 200); SDL_RenderFillRect(renderer,&sensor); SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); } } } float Simulation::run(NeuralNet* net) { float cicle = 0; vector<double> inputs; for (auto s : car_sensor_angles) { inputs.push_back(s.second); } net->load_inputs(&inputs, false); vector<double> output = net->calculate_output(); car_velocity = newmap(output[0], 0, 1, 0, car_max_velocity); car_angle += newmap(output[1], 0, 1, -car_max_angle, car_max_angle); if (car_angle > 360)car_angle -= 360; if (car_angle < -360)car_angle += 360; if (!car_crashed) { if (distance(car_position, road[road.size() - 1].first) < 50) { for (int i = 0; i < 5; i++) generate_road(); } if ((distance(car_position, road[road.size() - 1].first) > 200)|| (car_angle+275)-last_angle>150 || (car_angle + 275)-last_angle<-150 ) { car_crashed = true; } car_position.x += cos(to_rad(car_angle - 90))*car_velocity; car_position.y += sin(to_rad(car_angle - 90))*car_velocity; for (auto& s : car_sensor_angles) { SDL_Point sensor = { car_position.x + cos(to_rad(car_angle + s.first.first -90))*s.first.second,car_position.y + sin(to_rad(car_angle + s.first.first -90))*s.first.second }; float angle = angular_coefficient(road[1].first, road[0].first); SDL_Point a; a.x = road[0].first.x + sqrt(pow(road[0].second, 2) / (1 + 1 / pow(angle, 2))); a.y = -1 / angle*(a.x - road[ 0].first.x) + road[0].first.y; SDL_Point b; b.x = road[0].first.x - sqrt(pow(road[0].second, 2) / (1 + 1 / pow(angle, 2))); b.y = -1 / angle*(b.x - road[ 0].first.x) + road[0].first.y; for (int r = 1; r < road.size(); r++) { float angle = angular_coefficient(road[r].first, road[r-1].first); SDL_Point a1; a1.x = road[r ].first.x + sqrt(pow(road[r ].second, 2) / (1 + 1 / pow(angle, 2))); a1.y = -1 / angle*(a1.x - road[r ].first.x) + road[r ].first.y; SDL_Point b1; b1.x = road[r ].first.x - sqrt(pow(road[r ].second, 2) / (1 + 1 / pow(angle, 2))); b1.y = -1 / angle*(b1.x - road[r ].first.x) + road[r ].first.y; if (do_intersect(a, a1, sensor, car_position)){ s.second = intersection(car_position, sensor, a, a1); break; } if (do_intersect(b, b1, sensor, car_position)) { s.second = intersection(car_position, sensor, b, b1); break; } if(!do_intersect(a, a1, sensor, car_position) && !do_intersect(b, b1, sensor, car_position)) { s.second = 0; } a = a1; b = b1; } } } cicle+=car_velocity*10/distance(car_position,road[road.size()-1].first); return cicle; }
38.311111
360
0.613109
[ "vector" ]
7557dc0cf5531933b2abb48e1b8adb0eaf11d7db
3,127
h
C
IPZ_Client/src/renderer.h
Dawid-Olcha/IPZ_Project
83d1b5809635774b61c65df74611680147576b0d
[ "MIT" ]
null
null
null
IPZ_Client/src/renderer.h
Dawid-Olcha/IPZ_Project
83d1b5809635774b61c65df74611680147576b0d
[ "MIT" ]
null
null
null
IPZ_Client/src/renderer.h
Dawid-Olcha/IPZ_Project
83d1b5809635774b61c65df74611680147576b0d
[ "MIT" ]
null
null
null
#pragma once #include <array> #include "shader.h" #include "camera.h" #include "buffer.h" static const vec4 quadVertexPos[4] = { {-0.5f, 0.0f, 0.5f, 1.0f}, { 0.5f, 0.0f, 0.5f, 1.0f}, { 0.5f, 0.0f, -0.5f, 1.0f}, {-0.5f, 0.0f, -0.5f, 1.0f} }; struct QuadVertex{ vec3 position; vec4 color; vec2 texCoord; float texIndex; float tilingFactor; //??? }; class Renderer{ Renderer() = default; static Renderer& getInstance(){ static Renderer instance; return instance; } public: Renderer(Renderer const&) = delete; void operator=(Renderer const&) = delete; static void init(){getInstance().x_init();} static void begin(const std::shared_ptr<Camera>& camera){getInstance().x_begin(camera);} static void end(){getInstance().x_end();} static void DrawQuad(const mat4 &transform, const std::shared_ptr<Texture> &texture= nullptr, float tilingFactor = 1.f, const vec4 &tintColor = {1,1,1,1}) {getInstance().x_DrawQuad(transform, texture, tilingFactor, tintColor);} static void DrawQuad(const vec3 &pos, const vec2 &size, const std::shared_ptr<Texture> &texture = nullptr, float tilingFactor = 1.f, const vec4 &tintColor = {1,1,1,1}) {getInstance().x_DrawQuad(pos, size, texture, tilingFactor, tintColor);} static void DrawQuad(const vec3 &pos, const vec2 &size, const vec4 &tintColor) {getInstance().x_DrawQuad(pos, size, tintColor);} static void setViewPort(uvec2 pos, uvec2 size){getInstance().x_setViewPort(pos, size);} static void setClearColor(vec4 color){getInstance().x_setClearColor(color);} private: static const uint maxVertices = 0xFFFFF; // hmm lets see how this goes static const uint maxIndices = 0xFFFFF; static const uint maxTexturesPerBuffer = 32; // idk about that // const uint maxTexturesTotal = 32*5; for now we make it single buffer QuadVertex* intermBuffer = nullptr; QuadVertex* intermBufferPtr = nullptr; uint indexCount = 0; uint textureCount = 0; std::shared_ptr<VertexArray> vertexArray; std::shared_ptr<VertexBuffer> currentBuffer; std::shared_ptr<Camera> camera = nullptr; std::shared_ptr<Texture> whiteTex; std::array<std::shared_ptr<Texture>, maxTexturesPerBuffer> textureSlots; int texSamplers[maxTexturesPerBuffer]; void x_init(); void x_begin(const std::shared_ptr<Camera>& camera); void x_end(); void x_DrawQuad(const mat4 &transform, const std::shared_ptr<Texture> &texture, float tilingFactor, const vec4 &tintColor); void x_DrawQuad(const vec3 &pos, const vec2 &size, const std::shared_ptr<Texture> &texture, float tilingFactor, const vec4 &tintColor); void x_DrawQuad(const vec3 &pos, const vec2 &size, const vec4 &tintColor); void x_setViewPort(uvec2 pos, uvec2 size); void x_setClearColor(vec4 color); void x_setCamera(std::shared_ptr<Camera> camera); void x_getCamera(std::shared_ptr<Camera> camera); void startBatch(); void nextBatch(); void flush(); };
31.908163
110
0.67189
[ "transform" ]
755edc2b1b69cb485c5d6575edafdf3feb2de653
3,072
h
C
src/core/tree/list.h
alicemona/Smala
6f66c3b4bb111993a6bcf148e84c229fb3fa3534
[ "BSD-2-Clause" ]
null
null
null
src/core/tree/list.h
alicemona/Smala
6f66c3b4bb111993a6bcf148e84c229fb3fa3534
[ "BSD-2-Clause" ]
null
null
null
src/core/tree/list.h
alicemona/Smala
6f66c3b4bb111993a6bcf148e84c229fb3fa3534
[ "BSD-2-Clause" ]
null
null
null
/* * djnn v2 * * The copyright holders for the contents of this file are: * Ecole Nationale de l'Aviation Civile, France (2018) * See file "license.terms" for the rights and conditions * defined by copyright holders. * * * Contributors: * Mathieu Magnaudet <mathieu.magnaudet@enac.fr> * Mathieu Poirier <mathieu.poirier@enac.fr> * */ #pragma once #include "component.h" #include <list> #include <iostream> #include "ref_property.h" #include "int_property.h" namespace djnn { using namespace std; class AbstractList : public Container { public: AbstractList (); AbstractList (Process *parent, const string& name); void add_child (Process* c, const string& name) override; void insert (Process* c, const string& spec); void remove_child (Process* c) override; void remove_child (const string &name) override; void dump(int level=0) override; Process* find_component (const string &path) override; virtual ~AbstractList () {}; int size () { return _size->get_value (); } protected: virtual void finalize_child_insertion (Process *child) = 0; RefProperty *_added, *_removed; IntProperty *_size; }; class List : public AbstractList { public: List (); List (Process *parent, const string& name); virtual ~List (); void serialize (const string& type) override; Process* clone () override; private: void finalize_child_insertion (Process *child) override; }; class ListIterator : public Process { public: ListIterator (Process *parent, const string &name, Process *list, Process *action, bool model = true); virtual ~ListIterator () {} void activate () override; void deactivate () override {}; void post_activate () override; private: Process *_action; Container *_list; }; class BidirectionalListIterator : public Process { private: class IterAction : public Process { public: IterAction (Process *parent, const string& name, List *list, RefProperty *iter, IntProperty *index, bool forward); virtual ~IterAction () {} void activate () override; void deactivate () override {} private: List* _list; RefProperty *_iter; IntProperty *_index; bool _forward; }; class ResetAction : public Process { public: ResetAction (Process *parent, const string& name, IntProperty *index); virtual ~ResetAction () {} void activate () override; void deactivate () override {} private: IntProperty *_index; }; public: BidirectionalListIterator (Process *parent, const string& name, Process* list); virtual ~BidirectionalListIterator (); void activate () override; void deactivate () override; void serialize (const string& type) override; private: List* _list; Process *_next, *_previous, *_reset; RefProperty *_iter; IntProperty *_index; Coupling *_c_next, *_c_reset, *_c_previous; Process *_next_action, *_previous_action, *_reset_action; }; }
27.428571
120
0.666992
[ "model" ]
7566f0f20351e7c6727b35ed3ed7e8a34ba3a1e2
928
h
C
322.coin-change/solution.h
ZYBaisichen/LeetCodeBsc
1ae4ca768ed70bb40cc93d5507fbbdc17b3731f5
[ "MIT" ]
2
2021-04-23T04:35:17.000Z
2021-04-24T07:57:03.000Z
322.coin-change/solution.h
ZYBaisichen/LeetCodeBsc
1ae4ca768ed70bb40cc93d5507fbbdc17b3731f5
[ "MIT" ]
null
null
null
322.coin-change/solution.h
ZYBaisichen/LeetCodeBsc
1ae4ca768ed70bb40cc93d5507fbbdc17b3731f5
[ "MIT" ]
null
null
null
/*** * @Author: baisichen * @Date: 2021-04-22 10:58:26 * @LastEditTime: 2021-04-24 16:53:54 * @LastEditors: baisichen * @Description: 矩形区域不超过K的最大数值和 */ #include <iostream> #include <vector> #include <set> using namespace std; class Solution { public: int coinChange(vector<int>& coins, int amount) { int len = coins.size(); if (len == 0){ return 0; } vector<int> dp(amount+1, -1); dp[0] = 0; for (int i=1; i<=amount; i++) { int min = INT_MAX; int flag = false; for (int j=0;j<len;j++) { if (i>=coins[j]) { if(min > dp[i-coins[j]] && dp[i-coins[j]] != -1) {//注意这里,找最小值时,应该将-1这个特殊状态排除在外,-1为未找到相关组合的硬币 min = dp[i-coins[j]]; } } } if (min != INT_MAX) { dp[i] = min + 1; } } return dp[amount]; } }; int main(){ Solution a; vector<int> b; b.push_back(1); b.push_back(2); b.push_back(5); cout << a.coinChange(b,11) <<endl; }
20.622222
97
0.552802
[ "vector" ]
7569dcdf5db5a6bba94734b6b78c38f83ca1e8d0
3,723
h
C
src/RESTAPI_objects.h
shimmy568/wlan-cloud-ucentralgw
806e24e1e666c31175c059373440ae029d9fff67
[ "BSD-3-Clause" ]
null
null
null
src/RESTAPI_objects.h
shimmy568/wlan-cloud-ucentralgw
806e24e1e666c31175c059373440ae029d9fff67
[ "BSD-3-Clause" ]
null
null
null
src/RESTAPI_objects.h
shimmy568/wlan-cloud-ucentralgw
806e24e1e666c31175c059373440ae029d9fff67
[ "BSD-3-Clause" ]
null
null
null
// // License type: BSD 3-Clause License // License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE // // Created by Stephane Bourque on 2021-03-04. // Arilia Wireless Inc. // #ifndef UCENTRAL_RESTAPI_OBJECTS_H #define UCENTRAL_RESTAPI_OBJECTS_H #include "Poco/JSON/Object.h" namespace uCentral::Objects { struct AclTemplate { bool Read_ = true ; bool ReadWrite_ = true ; bool ReadWriteCreate_ = true ; bool Delete_ = true ; bool PortalLogin_ = true ; void to_json(Poco::JSON::Object &Obj) const ; }; struct WebToken { std::string access_token_; std::string refresh_token_; std::string id_token_; std::string token_type_; std::string username_; unsigned int expires_in_; unsigned int idle_timeout_; AclTemplate acl_template_; uint64_t created_; void to_json(Poco::JSON::Object &Obj) const ; }; struct ConnectionState { uint64_t MessageCount; std::string SerialNumber; std::string Address; uint64_t UUID; uint64_t PendingUUID; uint64_t TX, RX; bool Connected; uint64_t LastContact; std::string Firmware; bool VerifiedCertificate; void to_json(Poco::JSON::Object &Obj) const; }; struct Device { std::string SerialNumber; std::string DeviceType; std::string MACAddress; std::string Manufacturer; uint64_t UUID; std::string Configuration; std::string Notes; uint64_t CreationTimestamp; uint64_t LastConfigurationChange; uint64_t LastConfigurationDownload; std::string Owner; std::string Location; std::string Firmware; void to_json(Poco::JSON::Object &Obj) const; void to_json_with_status(Poco::JSON::Object &Obj) const; bool from_json(Poco::JSON::Object::Ptr Obj); void Print() const; }; struct Statistics { uint64_t UUID; std::string Data; uint64_t Recorded; void to_json(Poco::JSON::Object &Obj) const; }; struct HealthCheck { uint64_t UUID; std::string Data; uint64_t Recorded; uint64_t Sanity; void to_json(Poco::JSON::Object &Obj) const; }; struct Capabilities { std::string Capabilities; uint64_t FirstUpdate; uint64_t LastUpdate; void to_json(Poco::JSON::Object &Obj) const; }; struct DeviceLog { enum Level { LOG_EMERG = 0, /* system is unusable */ LOG_ALERT = 1, /* action must be taken immediately */ LOG_CRIT = 2, /* critical conditions */ LOG_ERR = 3, /* error conditions */ LOG_WARNING = 4, /* warning conditions */ LOG_NOTICE = 5, /* normal but significant condition */ LOG_INFO = 6, /* informational */ LOG_DEBUG = 7 /* debug-level messages */ }; std::string Log; std::string Data; uint64_t Severity; uint64_t Recorded; uint64_t LogType; void to_json(Poco::JSON::Object &Obj) const; }; struct DefaultConfiguration { std::string Name; std::string Configuration; std::string Models; std::string Description; uint64_t Created; uint64_t LastModified; void to_json(Poco::JSON::Object &Obj) const; bool from_json(Poco::JSON::Object::Ptr Obj); }; struct CommandDetails { std::string UUID; std::string SerialNumber; std::string Command; std::string Status; std::string SubmittedBy; std::string Results; std::string Details; std::string ErrorText; uint64_t Submitted; uint64_t Executed; uint64_t Completed; uint64_t RunAt; uint64_t ErrorCode; uint64_t Custom; uint64_t WaitingForFile; uint64_t AttachDate; uint64_t AttachSize; std::string AttachType; void to_json(Poco::JSON::Object &Obj) const; }; struct BlackListedDevice { std::string SerialNumber; std::string Reason; std::string Author; uint64_t Created; void to_json(Poco::JSON::Object &Obj) const; }; } #endif //UCENTRAL_RESTAPI_OBJECTS_H
23.865385
97
0.710717
[ "object" ]
756b12946a72d18ed53e16cde6615329c02c366e
10,320
h
C
header/octree.h
AssassinTee/OcTree
9ebaaad03a17b3583a8fe2251353fd3b78445b1d
[ "BSD-3-Clause" ]
null
null
null
header/octree.h
AssassinTee/OcTree
9ebaaad03a17b3583a8fe2251353fd3b78445b1d
[ "BSD-3-Clause" ]
null
null
null
header/octree.h
AssassinTee/OcTree
9ebaaad03a17b3583a8fe2251353fd3b78445b1d
[ "BSD-3-Clause" ]
null
null
null
#ifndef OCTREE_H #define OCTREE_H #include <list> #include <string> #include <limits>//<< Operator #include <iomanip>//<< Operator #include <cstring>//memcopy for copy constructor! #include <fstream>//serialize-stuff #include <sstream>//node2string #include <functional> #include <boost/filesystem.hpp>//serialize and build a filesystem under ../serial_data! //#####WARNING - THIS PART CAN CASE A LINKER MISTAKE####### #define OCTYPE float //# //######################################################### //#define CEREAL_THREAD_SAFE 1//This could be saver and better, i don't know #include <cereal/archives/binary.hpp> #include <cereal/types/polymorphic.hpp> #include <cereal/types/list.hpp> #define OCDIM 3 //size of the dimension for the tree #define OCSIZE 8 //size of an octal tree(!!!); its 2^3; #ifdef OCDEBUGLOADTEST #define OCDEBUG #define OCLOADTEST //Test the octree with a main #endif #ifdef OCDEBUGALL #define OCDEBUG #define OCSERIALICEALL //Activate the output for every single serialized object #define OCDESERIALIZEALL //Activate the output for every single deserialized object #define OCDRAW //Activate the output when any draw-function, but I would not recommend drawing all nodes for debug #define OCINSERT //Activate the output for the insert #define OCDRAWALL //Activate the output for all drawn leafs #define OCDELETEALL //Activates the output for all deleted nodes #endif #ifdef OCDEBUG//Activates ALL options except BIGTEST #define OCDELETE //Activate the output for deleting the OCTree #define OCCLEAR //Activate the output for clear #define OCSERIALIZE //Activate the output for serialize #define OCDESERIALIZE //Activate the output for deserialize #endif /**DRAWING INTERFACE*/ class CDrawTree { public: virtual void draw() = 0; virtual void draw(double fromx, double fromy, double fromz, double tox, double toy, double toz) = 0; virtual void draw(double x, double y, double z) = 0; private: }; /**NODES*/ template <class CElement> class CNode : public CDrawTree { public: virtual ~CNode() {}; virtual bool insert(double x, double y, double z, CElement* elem, double* divLimit, unsigned long* numNodes, unsigned long* numElements) = 0; virtual std::list<CElement> getElements() = 0; virtual CNode<CElement>* getNode(int index) = 0; virtual void serialize(std::string path) = 0; virtual void deserialize(std::string path) = 0; virtual bool isBranch() = 0; virtual unsigned long getTreeLevel() = 0; unsigned int getLevel() {return m_level;}; //TODO: virtual *unkown find(x, y, z) = 0; really? or is draw enough template <class AnotherCElement>//Eleminates shadowing?! friend std::ostream& operator<<(std::ostream& os, CNode<AnotherCElement>& node); template <class Archive> void serialize( Archive & ar ) { ar( cereal::binary_data( ma_min, sizeof(double)*OCDIM), cereal::binary_data( ma_max, sizeof(double)*OCDIM), m_level); //std::cout << "Base got serialized" << std::endl; } private: protected: //virtual bool isLeaf() = 0; //Needed? bool isInRange(double fromx, double fromy, double fromz, double tox, double toy, double toz); bool isInNode(double x, double y, double z); //TODO: Limits! unsigned int m_level; bool m_serialized;//Needed! double ma_min[OCDIM]; double ma_max[OCDIM]; }; template <class CElement> class CNodeBranch : public CNode<CElement> { public: CNodeBranch() {}; CNodeBranch(CNodeBranch* other); CNodeBranch(CNodeBranch* other, bool isSerialized); CNodeBranch(unsigned int level, double x[OCDIM], double y[OCDIM], bool isSerialized=false); CNodeBranch(unsigned int level, double x1, double x2, double x3, double y1, double y2, double y3, bool isSerialized=false); virtual ~CNodeBranch(); CNode<CElement>* getNode(int index){ return mpa_Nodes[index];}; bool insert(double x, double y, double z, CElement* elem, double* divLimit, unsigned long* numNodes, unsigned long* numElements); std::list<CElement> getElements(); unsigned long getTreeLevel(); bool isBranch() {return true;}; //Serialization void serialize(std::string path); void deserialize(std::string path); template<class Archive> void serialize(Archive & archive) { archive( cereal::base_class<CNode<CElement> >(this)); // serialize things by passing them to the archive } //Draw void draw();//should call the draw of all subnodes void draw(double fromx, double fromy, double fromz, double tox, double toy, double toz); void draw(double x, double y, double z); // Register DerivedClassOne protected: private: CNode<CElement>* mpa_Nodes[OCSIZE]{0};//i'd like it more to init this in the constructor, but ok }; template <class CElement> class CNodeLeaf : public CNode<CElement> { public: CNodeLeaf() {}; CNodeLeaf(CNodeLeaf* other, bool isSeralized); CNodeLeaf(unsigned int level, double x[OCDIM], double y[OCDIM]); CNodeLeaf(unsigned int level, double x1, double x2, double x3, double y1, double y2, double y3); virtual ~CNodeLeaf(); CNode<CElement>* getNode(int index){ return nullptr;}; bool insert(double x, double y, double z, CElement* elem, double* divLimit, unsigned long* numNodes, unsigned long* numElements); std::list<CElement> getElements() { return mpa_Elements;}; unsigned long getTreeLevel() {return this->getLevel();}; bool isBranch() {return false;}; //Serialization void serialize(std::string path) {return;};//Nothing to do here void deserialize(std::string path) {return;};//Nothing to do here template<class Archive> void serialize(Archive & archive)//seralize the list of pointers! { archive( cereal::base_class<CNode<CElement> >(this)); archive( mpa_Elements ); // serialize things by passing them to the archive //std::cout << "Leaf got serialized" << std::endl; } //Draw void draw();//should draw the Elements in the list void draw(double fromx, double fromy, double fromz, double tox, double toy, double toz); void draw(double x, double y, double z); protected: private: std::list<CElement> mpa_Elements; }; /**NODE-GLOBAL*/ template <class CElement> static void serializeBranch(CNodeBranch<CElement>* node); template <class CElement> static void serializeLeaf(CNodeLeaf<CElement>* node); template <class CElement> static CNodeBranch<CElement>* deserializeBranch(const std::string& b); template <class CElement> static CNodeLeaf<CElement>* deserializeLeaf(const std::string& b); template <class CElement> static std::string node2str(CNode<CElement>* node); template <class CElement> std::ostream& operator<<(std::ostream& os, CNode<CElement>& node); void createDirectories(std::string path); /**OCTREE-GLOBAL*/ static const std::string serializationPath = "../ocdata/"; static const std::string mimeTypeOc = ".oc"; static const std::string mimeTypeBranch = ".ocbranch"; static const std::string mimeTypeLeaf = ".ocleaf"; static const std::string mimeTypeTreeData = ".ocdata"; /**OCTREE*/ template <class CElement>//Element to insert in the octree//Why a template? Later to Vector class class COcTree : CDrawTree { public: COcTree(std::string name, double divLimit, double y1, double y2, double y3);//TODO: konstruktor bekommt daten COcTree(std::string name, double divLimit, double x[OCDIM], double y[OCDIM]); COcTree(std::string name, double divLimit, double x1, double x2, double x3, double y1, double y2, double y3); virtual ~COcTree();//TODO: Destruktor??? bool insert(double p[OCDIM], CElement* dataset);//Haenge in den Baum ein bool insert(double x, double y, double z, CElement* dataset);//Haenge in den Baum ein void clear(); //Getter unsigned long numNodes() {return m_numNodes;}; unsigned long numElements() {return m_numElements;}; unsigned long getLevels(); //Draw void draw(); void draw(double fromx, double fromy, double fromz, double tox, double toy, double toz); void draw(double x, double y, double z); //Serialize: TODO: Change/Remove this void serialize() {mp_Origin->serialize(serializationPath);}; void deserialize() {mp_Origin->deserialize(serializationPath);}; void save(); //{}; void load(); //{mp_Origin->deserialize(serializationPath+m_Name+'/');} bool isLoadable(); protected: private: void serializeTreeData(); void deserializeTreeData(); void setData(std::string name, double divLimit);//Helper-Funktion fuer den Konstruktor //Variabeln CNode<CElement>* mp_Origin;//Wurzelknoten double m_divLimit; bool m_dataChanged;//triggers save on delete unsigned long m_numNodes;//Needed?? Anzahl der Nodes unsigned long m_numElements;//Needed?? Anzahl der Elemente des Baumes std::string m_Name;//Name is needed, when you restart the programm, you can actually deserialize it if the path is there!!! //The Name is required to find the right OCTree and don't run into abinguoity (multy purpose fails) }; // Register EmbarassingDerivedClass with a less embarrasing name CEREAL_REGISTER_TYPE(CNodeBranch<float>); CEREAL_REGISTER_TYPE_WITH_NAME(CNodeLeaf<float>, "CNodeLeaf"); //CEREAL_REGISTER_TYPE_WITH_NAME(std::list<int>, "mpa_Elements"); // Note that there is no need to register the base class, only derived classes // However, since we did not use cereal::base_class, we need to clarify // the relationship (more on this later) CEREAL_REGISTER_POLYMORPHIC_RELATION(CNode<float>, CNodeBranch<float>); CEREAL_REGISTER_POLYMORPHIC_RELATION(CNode<float>, CNodeLeaf<float>); #endif // OCTREE_H
38.222222
149
0.669671
[ "object", "vector" ]
757410b18ada576cb0a76561b45b841c5ec20e51
2,301
h
C
fdbclient/AnnotateActor.h
PierreZ/foundationdb
d97d9681766766836f991ec65f64b66b654b966c
[ "Apache-2.0" ]
11,024
2018-04-19T16:06:46.000Z
2022-03-31T23:43:55.000Z
fdbclient/AnnotateActor.h
PierreZ/foundationdb
d97d9681766766836f991ec65f64b66b654b966c
[ "Apache-2.0" ]
4,430
2018-04-19T17:12:33.000Z
2022-03-31T23:56:34.000Z
fdbclient/AnnotateActor.h
PierreZ/foundationdb
d97d9681766766836f991ec65f64b66b654b966c
[ "Apache-2.0" ]
1,146
2018-04-19T16:45:57.000Z
2022-03-30T10:43:57.000Z
/* * AnnotateActor.h * * This source file is part of the FoundationDB open source project * * Copyright 2013-2021 Apple Inc. and the FoundationDB project 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 "flow/flow.h" #include "flow/network.h" #include <string_view> // Used to manually instrument waiting actors to collect samples for the // sampling profiler. struct AnnotateActor { unsigned index; bool set; AnnotateActor() : set(false) {} AnnotateActor(LineageReference* lineage) : set(false) { #ifdef ENABLE_SAMPLING if (lineage->getPtr() != 0) { index = g_network->getActorLineageSet().insert(*lineage); set = (index != ActorLineageSet::npos); } #endif } AnnotateActor(const AnnotateActor& other) = delete; AnnotateActor(AnnotateActor&& other) = delete; AnnotateActor& operator=(const AnnotateActor& other) = delete; AnnotateActor& operator=(AnnotateActor&& other) { if (this == &other) { return *this; } this->index = other.index; this->set = other.set; other.set = false; return *this; } ~AnnotateActor() { #ifdef ENABLE_SAMPLING if (set) { g_network->getActorLineageSet().erase(index); } #endif } }; enum class WaitState { Disk, Network, Running }; // usually we shouldn't use `using namespace` in a header file, but literals should be safe as user defined literals // need to be prefixed with `_` using namespace std::literals; constexpr std::string_view to_string(WaitState st) { switch (st) { case WaitState::Disk: return "Disk"sv; case WaitState::Network: return "Network"sv; case WaitState::Running: return "Running"sv; default: return ""sv; } } #ifdef ENABLE_SAMPLING extern std::map<WaitState, std::function<std::vector<Reference<ActorLineage>>()>> samples; #endif
25.01087
116
0.718818
[ "vector" ]
75776abeae4f00a331ca410a1791298f1083108c
2,656
h
C
osx/devkit/plug-ins/manipOverride/rockingTransform2.h
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
10
2018-03-30T16:09:02.000Z
2021-12-07T07:29:19.000Z
osx/devkit/plug-ins/manipOverride/rockingTransform2.h
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
null
null
null
osx/devkit/plug-ins/manipOverride/rockingTransform2.h
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
9
2018-06-02T09:18:49.000Z
2021-12-20T09:24:35.000Z
//- // ========================================================================== // Copyright 1995,2006,2008 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk // license agreement provided at the time of installation or download, // or which otherwise accompanies this software in either electronic // or hard copy form. // ========================================================================== //+ #include <maya/MMatrix.h> #include <maya/MPxTransform.h> #include <maya/MPxTransformationMatrix.h> class MDataHandle; class MDGContext; class MPlug; // // Define declarations // #define kRockingTransformNodeID 0x8101B #define kRockingTransformMatrixID 0x8101C #define ReturnOnError(status) \ if (MS::kSuccess != status) { \ return status; \ } // // Class declarations -- matrix and transform // class rockingTransformMatrix : public MPxTransformationMatrix { // A really simple implementation of MPxTransformationMatrix. // The methods include: // - Two accessor methods for getting and setting the // rock // - The virtual asMatrix() method which passes the matrix // back to Maya when the command "xform -q -ws -m" is invoked public: rockingTransformMatrix(); static void *creator(); virtual MMatrix asMatrix() const; virtual MMatrix asMatrix(double percent) const; virtual MMatrix asRotateMatrix() const; // Degrees double getRockInX() const; void setRockInX( double rock ); static MTypeId id; protected: typedef MPxTransformationMatrix ParentClass; // Degrees double rockXValue; }; class rockingTransformNode : public MPxTransform { // A really simple custom transform. public: rockingTransformNode(); rockingTransformNode(MPxTransformationMatrix *); virtual ~rockingTransformNode(); virtual MPxTransformationMatrix *createTransformationMatrix(); virtual void postConstructor(); virtual MStatus validateAndSetValue(const MPlug& plug, const MDataHandle& handle, const MDGContext& context); virtual void resetTransformation (MPxTransformationMatrix *); virtual void resetTransformation (const MMatrix &); // Utility for getting the related rock matrix pointer rockingTransformMatrix *getRockingTransformMatrix(); const char* className(); static void * creator(); static MStatus initialize(); static MTypeId id; protected: // Degrees static MObject aRockInX; double rockXValue; typedef MPxTransform ParentClass; }; class DegreeRadianConverter { public: double degreesToRadians( double degrees ); double radiansToDegrees( double radians ); };
26.039216
77
0.697289
[ "transform" ]
7578afab34cf3115b87b2a21a239fed9a94b03c5
645
h
C
src/components.h
cudaf/pagerank-sticd
506a498de6bb10c5ad50353001d80e1b86a52003
[ "MIT" ]
null
null
null
src/components.h
cudaf/pagerank-sticd
506a498de6bb10c5ad50353001d80e1b86a52003
[ "MIT" ]
null
null
null
src/components.h
cudaf/pagerank-sticd
506a498de6bb10c5ad50353001d80e1b86a52003
[ "MIT" ]
null
null
null
#pragma once #include <vector> #include "fill.h" #include "dfs.h" #include "dfsEnd.h" using std::vector; // Finds Strongly Connected Components (SCC) using Kosaraju's algorithm. template <class G> auto components(G& x, G& y) { using K = typename G::TKey; // original dfs auto vis = x.createVertexData(bool()); vector<K> vs; for (auto u : x.vertices()) if (!vis[u]) dfsEndLoop(x, u, vis, vs); // transpose dfs vector<vector<K>> a; fill(vis, false); while (!vs.empty()) { K u = vs.back(); vs.pop_back(); if (vis[u]) continue; a.push_back(vector<K>()); dfsLoop(y, u, vis, a.back()); } return a; }
19.545455
72
0.610853
[ "vector" ]
7579cbcf14c183430744ac2554bd7247fc5118bf
2,268
h
C
database/workingmemory.h
GAIA-GMU/PAR
4a19c119c0e6537b98c948cc48960e8f17c2eccd
[ "Apache-2.0" ]
4
2019-01-03T08:45:59.000Z
2022-02-04T16:04:03.000Z
database/workingmemory.h
GAIA-GMU/PAR
4a19c119c0e6537b98c948cc48960e8f17c2eccd
[ "Apache-2.0" ]
3
2015-10-21T16:57:56.000Z
2018-04-08T13:40:36.000Z
database/workingmemory.h
GAIA-GMU/PAR
4a19c119c0e6537b98c948cc48960e8f17c2eccd
[ "Apache-2.0" ]
2
2016-04-14T08:40:34.000Z
2016-05-25T17:10:08.000Z
#ifndef _WORKING_MEMORY_H #define _WORKING_MEMORY_H #include "metaobject.h" #include "metaaction.h" //#include "Python.h" #include "utility.h" class FailData; class iPAR { private: int iparID; double start_time; float duration; bool finished; int priority; std::map<parProperty*,double> properties; FailData *fail_data; bool fail_parent;//This is set when the parent action should fail (for certain types of complex actions) std::string manner; public: std::vector<MetaObject*> objects; MetaObject *agent; int enable_act; int enabled_act; MetaAction* par; iPAR(std::string, const std::string&, char* objnames[]); iPAR(std::string, const std::string&, std::vector<char*> *objnames); iPAR(std::string, const std::string&); // set the objects separately iPAR(int actID); // iPARs for iPAR actions already in the Actionary iPAR(MetaAction* act); //iPARS that we just want a skeleton for, and will fill in later iPAR* copyIPAR(); // return a copy of this iPAR void copyValuesToPython();//Copies all python specific values to python for easier scripting int getID(){return iparID;} MetaObject* getAgent(); void setAgent(MetaObject* agent); void setAgent(const std::string& agname); void setObject(MetaObject* obj, int which); MetaObject* getObject(int which); double getStartTime(); float getDuration(); void setDuration(float d); void setStartTime(double t); void setStartTime(int hours, int minutes, int seconds); int getPriority(); void setPriority(int prior); void setPurposeEnableAct(int par_id); int getPurposeEnableAct(); void setEnabledAct(int par_id); int getEnabledAct(); void setProperty(parProperty*,double); double getProperty(parProperty*); parProperty* getPropertyType(int which); void setManner(const std::string&); std::string getManner(); void setFailParent(bool val) { fail_parent = val; } bool getFailParent() { return fail_parent; } void setFinished(bool fin){finished=fin;} bool getFinished(){return finished;} void setFailData(FailData* dat){fail_data=dat;} FailData* getFailData(){return fail_data;} //PyObject *testCulminationCond(); }; #endif
29.076923
105
0.70194
[ "vector" ]
757f68fabcaf3a687edb4db1fe9b8fcf609737ec
516
h
C
client/UI/Utils/SortUtils.h
gitdnd/NovusCore-Client
51e76ffe579734cb93a76b6f6d6db8bec8855676
[ "MIT" ]
29
2019-03-30T12:56:50.000Z
2022-03-10T05:44:14.000Z
client/UI/Utils/SortUtils.h
gitdnd/NovusCore-Client
51e76ffe579734cb93a76b6f6d6db8bec8855676
[ "MIT" ]
7
2020-01-16T13:55:46.000Z
2021-07-17T16:40:13.000Z
client/UI/Utils/SortUtils.h
gitdnd/NovusCore-Client
51e76ffe579734cb93a76b6f6d6db8bec8855676
[ "MIT" ]
10
2019-07-01T20:27:08.000Z
2021-12-19T16:57:33.000Z
#pragma once #include <NovusTypes.h> #include <entity/fwd.hpp> #include "../UITypes.h" namespace UIUtils::Sort { /* * Recursively updates depths of children changing it by modifier. * registry: Pointer to UI Registry. * transform: Transform from which to start update. * modifer: amount to modify depth by. */ void UpdateChildDepths(entt::registry* registry, entt::entity parent, u32& compoundDepth); void MarkSortTreeDirty(entt::registry* registry, entt::entity entity); };
30.352941
94
0.699612
[ "transform" ]
75886d113a5ab180da5dc265857d93080a247c6b
8,775
h
C
phog/dsl/tcond_language.h
xaviergeorge/ModelsPHOG
ca8c85d04974a748dece24a5194f45b38ea8bf23
[ "Apache-2.0" ]
5
2018-07-18T15:57:00.000Z
2020-11-23T18:52:58.000Z
phog/dsl/tcond_language.h
xaviergeorge/ModelsPHOG
ca8c85d04974a748dece24a5194f45b38ea8bf23
[ "Apache-2.0" ]
6
2019-01-18T18:01:09.000Z
2020-01-23T08:37:31.000Z
phog/dsl/tcond_language.h
xaviergeorge/ModelsPHOG
ca8c85d04974a748dece24a5194f45b38ea8bf23
[ "Apache-2.0" ]
2
2019-09-11T12:15:04.000Z
2020-03-03T09:15:46.000Z
/* Copyright 2015 Software Reliability Lab, ETH Zurich 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 SYNTREE_TCOND_LANGUAGE_H_ #define SYNTREE_TCOND_LANGUAGE_H_ #include <random> #include <set> #include <string> #include <vector> #include "glog/logging.h" #include "base/stringprintf.h" #include "base/stringset.h" #include "phog/tree/tree_index.h" #include "gflags/gflags.h" // Describes the base TCond language. Specifics may build on top of this basic language. class TCondLanguage { public: explicit TCondLanguage(StringSet* ss) : ss_(ss) { } typedef SequenceHashFeature Feature; typedef std::mt19937 RandomGen; enum class OpCmd { WRITE_TYPE = 0, WRITE_VALUE, WRITE_POS, UP, LEFT, RIGHT, DOWN_FIRST, DOWN_LAST, PREV_DFS, PREV_LEAF, NEXT_LEAF, PREV_NODE_VALUE, PREV_NODE_TYPE, PREV_NODE_CONTEXT, LAST_OP_CMD }; static std::string OpCmdStr(OpCmd cmd) { switch (cmd) { case OpCmd::WRITE_TYPE: return "WRITE_TYPE"; case OpCmd::WRITE_VALUE: return "WRITE_VALUE"; case OpCmd::WRITE_POS: return "WRITE_POS"; case OpCmd::UP: return "UP"; case OpCmd::LEFT: return "LEFT"; case OpCmd::RIGHT: return "RIGHT"; case OpCmd::DOWN_FIRST: return "DOWN_FIRST"; case OpCmd::DOWN_LAST: return "DOWN_LAST"; case OpCmd::PREV_DFS: return "PREV_DFS"; case OpCmd::PREV_LEAF: return "PREV_LEAF"; case OpCmd::NEXT_LEAF: return "NEXT_LEAF"; case OpCmd::PREV_NODE_VALUE: return "PREV_NODE_VALUE"; case OpCmd::PREV_NODE_TYPE: return "PREV_NODE_TYPE"; case OpCmd::PREV_NODE_CONTEXT: return "PREV_NODE_CONTEXT"; case OpCmd::LAST_OP_CMD: return "ERROR"; } return "?"; } struct Op { Op() : cmd(OpCmd::WRITE_TYPE), extra_data(-1) {} Op(OpCmd cmd) : cmd(cmd), extra_data(-1) {} Op(OpCmd cmd, int type) : cmd(cmd), extra_data(type) {} OpCmd cmd; int extra_data; inline bool operator==(const Op& o) const { return cmd == o.cmd && extra_data == o.extra_data; } inline bool operator!=(const Op& o) const { return !(*this == o); } inline bool operator<(const Op& o) const { if (cmd == o.cmd) return extra_data < o.extra_data; return cmd < o.cmd; } }; typedef std::vector<Op> Program; std::string ProgramToString(const Program& p) const; Program ParseStringToProgramOrDie(const std::string& s) const; // ExecutionForTree is created for a tree that remains constant and the nodes in the tree are given // in canonical order. This is, nodes are numbered in depth-first search left-to-right order. // // This class indexes the nodes of the tree so that PREV_NODE_TYPE, PREV_NODE_VALUE, etc can be // executed fast. class ExecutionForTree { public: ExecutionForTree(const StringSet* ss, const TreeStorage* tree) : ss_(ss), tree_(tree), index_by_node_type_(&af_by_nt_, tree), index_by_node_value_(&af_by_nv_, tree), index_by_node_context_(&af_by_nc_, tree) { index_by_node_type_.Build(); index_by_node_value_.Build(); index_by_node_context_.Build(); } // Returns true if each program operation could be performed, false otherwise. Updates the given traversal t. // // F(int op_added) // bool C(int called_function, SlicedTreeTraversal* t) template<class F> bool GetConditionedFeaturesForPosition(const Program& p, SlicedTreeTraversal* t, std::string* debug_info, const F& feature_callback) const { for (Op op : p) { switch (op.cmd) { case OpCmd::WRITE_TYPE: { int type = t->node().Type(); if (debug_info != nullptr) { StringAppendF(debug_info, "[WRITE_TYPE - %s] ", type >= 0 ? ss_->getString(type) : std::to_string(type).c_str()); } feature_callback(type); break; } case OpCmd::WRITE_VALUE: { int value = t->node().Value(); if (debug_info != nullptr) { StringAppendF(debug_info, "[WRITE_VALUE - %s] ", value >= 0 ? ss_->getString(value) : std::to_string(value).c_str()); } feature_callback(value); break; } case OpCmd::WRITE_POS: { if (debug_info != nullptr) { StringAppendF(debug_info, "[WRITE_POS - %d] ", t->node().child_index); } // Use negative value such that BranchCondProgram interprets it as number feature_callback(-1000 - t->node().child_index); break; } case OpCmd::UP: t->up(); break; case OpCmd::LEFT: t->left(); break; case OpCmd::RIGHT: t->right(); break; case OpCmd::DOWN_FIRST: { t->down_first_child(); break; } case OpCmd::DOWN_LAST: { t->down_last_child(); break; } case OpCmd::PREV_LEAF: for (;;) { if (t->left()) { while (t->down_last_child()) {} break; } else { if (!t->up()) break; } } break; case OpCmd::NEXT_LEAF: { for (;;) { if (t->right()) { while (t->down_first_child()) { } break; } else { if (!t->up()) break; } } break; } case OpCmd::PREV_DFS: if (t->left()) { while (t->down_last_child()) {} } else { t->up(); } break; case OpCmd::PREV_NODE_VALUE: { if (af_by_nv_.GetNodeActorSymbol(*t) != -1) { ActorSymbolIterator it( af_by_nv_.GetNodeActorSymbol(*t), *t, &index_by_node_value_); if (it.MoveLeft()) { *t = it.GetItem(); } } break; } case OpCmd::PREV_NODE_TYPE: { ActorSymbolIterator it( af_by_nt_.GetNodeActorSymbol(*t), *t, &index_by_node_type_); if (it.MoveLeft()) { *t = it.GetItem(); } break; } case OpCmd::PREV_NODE_CONTEXT: { ActorSymbolIterator it( af_by_nc_.GetNodeActorSymbol(*t), *t, &index_by_node_context_); if (it.MoveLeft()) { *t = it.GetItem(); } break; } case OpCmd::LAST_OP_CMD: break; } } if (debug_info != nullptr) { debug_info->append("\n"); } return true; } const StringSet* ss() const { return ss_; } const TreeStorage* tree() const { return tree_; } private: const StringSet* ss_; const TreeStorage* tree_; ActorFinderByNodeType af_by_nt_; ActorIndex index_by_node_type_; ActorFinderByNodeValue af_by_nv_; ActorIndex index_by_node_value_; ActorFinderByNodeContext af_by_nc_; ActorIndex index_by_node_context_; }; StringSet* ss() { return ss_; } const StringSet* ss() const { return ss_; } private: StringSet* ss_; }; // Hash for TCondLanguage::Program. namespace std { template <> struct hash<TCondLanguage::Program> { size_t operator()(const TCondLanguage::Program& x) const { unsigned result = 0; for (size_t i = 0; i < x.size(); ++i) { result = FingerprintCat(result, FingerprintCat(static_cast<int>(x[i].cmd), x[i].extra_data)); } return result; } }; } // Used in PerFeatureValueCounter namespace std { template <> struct hash<std::pair<TCondLanguage::Feature, TreeSubstitutionOnlyLabel> > { size_t operator()(const std::pair<TCondLanguage::Feature, TreeSubstitutionOnlyLabel>& x) const { return FingerprintCat(std::hash<TCondLanguage::Feature>()(x.first), std::hash<TreeSubstitutionOnlyLabel>()(x.second)); } }; } #endif /* SYNTREE_TCOND_LANGUAGE_H_ */
28.865132
144
0.575271
[ "vector" ]
75898340eb468ecf324b63bb1817c3db5b2b7b85
16,728
c
C
linux-5.4.67/fs/crypto/keysetup.c
d0lim/linux-class
4947e6915f0534648c7d0d9a3ef28b29165f0f6a
[ "MIT" ]
14
2021-11-04T07:47:37.000Z
2022-03-21T10:10:30.000Z
linux-5.4.67/fs/crypto/keysetup.c
d0lim/linux-class
4947e6915f0534648c7d0d9a3ef28b29165f0f6a
[ "MIT" ]
null
null
null
linux-5.4.67/fs/crypto/keysetup.c
d0lim/linux-class
4947e6915f0534648c7d0d9a3ef28b29165f0f6a
[ "MIT" ]
6
2021-11-02T10:56:19.000Z
2022-03-06T11:58:20.000Z
// SPDX-License-Identifier: GPL-2.0 /* * Key setup facility for FS encryption support. * * Copyright (C) 2015, Google, Inc. * * Originally written by Michael Halcrow, Ildar Muslukhov, and Uday Savagaonkar. * Heavily modified since then. */ #include <crypto/aes.h> #include <crypto/sha.h> #include <crypto/skcipher.h> #include <linux/key.h> #include "fscrypt_private.h" static struct crypto_shash *essiv_hash_tfm; static struct fscrypt_mode available_modes[] = { [FSCRYPT_MODE_AES_256_XTS] = { .friendly_name = "AES-256-XTS", .cipher_str = "xts(aes)", .keysize = 64, .ivsize = 16, }, [FSCRYPT_MODE_AES_256_CTS] = { .friendly_name = "AES-256-CTS-CBC", .cipher_str = "cts(cbc(aes))", .keysize = 32, .ivsize = 16, }, [FSCRYPT_MODE_AES_128_CBC] = { .friendly_name = "AES-128-CBC", .cipher_str = "cbc(aes)", .keysize = 16, .ivsize = 16, .needs_essiv = true, }, [FSCRYPT_MODE_AES_128_CTS] = { .friendly_name = "AES-128-CTS-CBC", .cipher_str = "cts(cbc(aes))", .keysize = 16, .ivsize = 16, }, [FSCRYPT_MODE_ADIANTUM] = { .friendly_name = "Adiantum", .cipher_str = "adiantum(xchacha12,aes)", .keysize = 32, .ivsize = 32, }, }; static struct fscrypt_mode * select_encryption_mode(const union fscrypt_policy *policy, const struct inode *inode) { if (S_ISREG(inode->i_mode)) return &available_modes[fscrypt_policy_contents_mode(policy)]; if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) return &available_modes[fscrypt_policy_fnames_mode(policy)]; WARN_ONCE(1, "fscrypt: filesystem tried to load encryption info for inode %lu, which is not encryptable (file type %d)\n", inode->i_ino, (inode->i_mode & S_IFMT)); return ERR_PTR(-EINVAL); } /* Create a symmetric cipher object for the given encryption mode and key */ struct crypto_skcipher *fscrypt_allocate_skcipher(struct fscrypt_mode *mode, const u8 *raw_key, const struct inode *inode) { struct crypto_skcipher *tfm; int err; tfm = crypto_alloc_skcipher(mode->cipher_str, 0, 0); if (IS_ERR(tfm)) { if (PTR_ERR(tfm) == -ENOENT) { fscrypt_warn(inode, "Missing crypto API support for %s (API name: \"%s\")", mode->friendly_name, mode->cipher_str); return ERR_PTR(-ENOPKG); } fscrypt_err(inode, "Error allocating '%s' transform: %ld", mode->cipher_str, PTR_ERR(tfm)); return tfm; } if (unlikely(!mode->logged_impl_name)) { /* * fscrypt performance can vary greatly depending on which * crypto algorithm implementation is used. Help people debug * performance problems by logging the ->cra_driver_name the * first time a mode is used. Note that multiple threads can * race here, but it doesn't really matter. */ mode->logged_impl_name = true; pr_info("fscrypt: %s using implementation \"%s\"\n", mode->friendly_name, crypto_skcipher_alg(tfm)->base.cra_driver_name); } crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); err = crypto_skcipher_setkey(tfm, raw_key, mode->keysize); if (err) goto err_free_tfm; return tfm; err_free_tfm: crypto_free_skcipher(tfm); return ERR_PTR(err); } static int derive_essiv_salt(const u8 *key, int keysize, u8 *salt) { struct crypto_shash *tfm = READ_ONCE(essiv_hash_tfm); /* init hash transform on demand */ if (unlikely(!tfm)) { struct crypto_shash *prev_tfm; tfm = crypto_alloc_shash("sha256", 0, 0); if (IS_ERR(tfm)) { if (PTR_ERR(tfm) == -ENOENT) { fscrypt_warn(NULL, "Missing crypto API support for SHA-256"); return -ENOPKG; } fscrypt_err(NULL, "Error allocating SHA-256 transform: %ld", PTR_ERR(tfm)); return PTR_ERR(tfm); } prev_tfm = cmpxchg(&essiv_hash_tfm, NULL, tfm); if (prev_tfm) { crypto_free_shash(tfm); tfm = prev_tfm; } } { SHASH_DESC_ON_STACK(desc, tfm); desc->tfm = tfm; return crypto_shash_digest(desc, key, keysize, salt); } } static int init_essiv_generator(struct fscrypt_info *ci, const u8 *raw_key, int keysize) { int err; struct crypto_cipher *essiv_tfm; u8 salt[SHA256_DIGEST_SIZE]; if (WARN_ON(ci->ci_mode->ivsize != AES_BLOCK_SIZE)) return -EINVAL; essiv_tfm = crypto_alloc_cipher("aes", 0, 0); if (IS_ERR(essiv_tfm)) return PTR_ERR(essiv_tfm); ci->ci_essiv_tfm = essiv_tfm; err = derive_essiv_salt(raw_key, keysize, salt); if (err) goto out; /* * Using SHA256 to derive the salt/key will result in AES-256 being * used for IV generation. File contents encryption will still use the * configured keysize (AES-128) nevertheless. */ err = crypto_cipher_setkey(essiv_tfm, salt, sizeof(salt)); if (err) goto out; out: memzero_explicit(salt, sizeof(salt)); return err; } /* Given the per-file key, set up the file's crypto transform object(s) */ int fscrypt_set_derived_key(struct fscrypt_info *ci, const u8 *derived_key) { struct fscrypt_mode *mode = ci->ci_mode; struct crypto_skcipher *ctfm; int err; ctfm = fscrypt_allocate_skcipher(mode, derived_key, ci->ci_inode); if (IS_ERR(ctfm)) return PTR_ERR(ctfm); ci->ci_ctfm = ctfm; if (mode->needs_essiv) { err = init_essiv_generator(ci, derived_key, mode->keysize); if (err) { fscrypt_warn(ci->ci_inode, "Error initializing ESSIV generator: %d", err); return err; } } return 0; } static int setup_per_mode_key(struct fscrypt_info *ci, struct fscrypt_master_key *mk) { struct fscrypt_mode *mode = ci->ci_mode; u8 mode_num = mode - available_modes; struct crypto_skcipher *tfm, *prev_tfm; u8 mode_key[FSCRYPT_MAX_KEY_SIZE]; int err; if (WARN_ON(mode_num >= ARRAY_SIZE(mk->mk_mode_keys))) return -EINVAL; /* pairs with cmpxchg() below */ tfm = READ_ONCE(mk->mk_mode_keys[mode_num]); if (likely(tfm != NULL)) goto done; BUILD_BUG_ON(sizeof(mode_num) != 1); err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, HKDF_CONTEXT_PER_MODE_KEY, &mode_num, sizeof(mode_num), mode_key, mode->keysize); if (err) return err; tfm = fscrypt_allocate_skcipher(mode, mode_key, ci->ci_inode); memzero_explicit(mode_key, mode->keysize); if (IS_ERR(tfm)) return PTR_ERR(tfm); /* pairs with READ_ONCE() above */ prev_tfm = cmpxchg(&mk->mk_mode_keys[mode_num], NULL, tfm); if (prev_tfm != NULL) { crypto_free_skcipher(tfm); tfm = prev_tfm; } done: ci->ci_ctfm = tfm; return 0; } static int fscrypt_setup_v2_file_key(struct fscrypt_info *ci, struct fscrypt_master_key *mk) { u8 derived_key[FSCRYPT_MAX_KEY_SIZE]; int err; if (ci->ci_policy.v2.flags & FSCRYPT_POLICY_FLAG_DIRECT_KEY) { /* * DIRECT_KEY: instead of deriving per-file keys, the per-file * nonce will be included in all the IVs. But unlike v1 * policies, for v2 policies in this case we don't encrypt with * the master key directly but rather derive a per-mode key. * This ensures that the master key is consistently used only * for HKDF, avoiding key reuse issues. */ if (!fscrypt_mode_supports_direct_key(ci->ci_mode)) { fscrypt_warn(ci->ci_inode, "Direct key flag not allowed with %s", ci->ci_mode->friendly_name); return -EINVAL; } return setup_per_mode_key(ci, mk); } err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, HKDF_CONTEXT_PER_FILE_KEY, ci->ci_nonce, FS_KEY_DERIVATION_NONCE_SIZE, derived_key, ci->ci_mode->keysize); if (err) return err; err = fscrypt_set_derived_key(ci, derived_key); memzero_explicit(derived_key, ci->ci_mode->keysize); return err; } /* * Find the master key, then set up the inode's actual encryption key. * * If the master key is found in the filesystem-level keyring, then the * corresponding 'struct key' is returned in *master_key_ret with * ->mk_secret_sem read-locked. This is needed to ensure that only one task * links the fscrypt_info into ->mk_decrypted_inodes (as multiple tasks may race * to create an fscrypt_info for the same inode), and to synchronize the master * key being removed with a new inode starting to use it. */ static int setup_file_encryption_key(struct fscrypt_info *ci, struct key **master_key_ret) { struct key *key; struct fscrypt_master_key *mk = NULL; struct fscrypt_key_specifier mk_spec; int err; switch (ci->ci_policy.version) { case FSCRYPT_POLICY_V1: mk_spec.type = FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR; memcpy(mk_spec.u.descriptor, ci->ci_policy.v1.master_key_descriptor, FSCRYPT_KEY_DESCRIPTOR_SIZE); break; case FSCRYPT_POLICY_V2: mk_spec.type = FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER; memcpy(mk_spec.u.identifier, ci->ci_policy.v2.master_key_identifier, FSCRYPT_KEY_IDENTIFIER_SIZE); break; default: WARN_ON(1); return -EINVAL; } key = fscrypt_find_master_key(ci->ci_inode->i_sb, &mk_spec); if (IS_ERR(key)) { if (key != ERR_PTR(-ENOKEY) || ci->ci_policy.version != FSCRYPT_POLICY_V1) return PTR_ERR(key); /* * As a legacy fallback for v1 policies, search for the key in * the current task's subscribed keyrings too. Don't move this * to before the search of ->s_master_keys, since users * shouldn't be able to override filesystem-level keys. */ return fscrypt_setup_v1_file_key_via_subscribed_keyrings(ci); } mk = key->payload.data[0]; down_read(&mk->mk_secret_sem); /* Has the secret been removed (via FS_IOC_REMOVE_ENCRYPTION_KEY)? */ if (!is_master_key_secret_present(&mk->mk_secret)) { err = -ENOKEY; goto out_release_key; } /* * Require that the master key be at least as long as the derived key. * Otherwise, the derived key cannot possibly contain as much entropy as * that required by the encryption mode it will be used for. For v1 * policies it's also required for the KDF to work at all. */ if (mk->mk_secret.size < ci->ci_mode->keysize) { fscrypt_warn(NULL, "key with %s %*phN is too short (got %u bytes, need %u+ bytes)", master_key_spec_type(&mk_spec), master_key_spec_len(&mk_spec), (u8 *)&mk_spec.u, mk->mk_secret.size, ci->ci_mode->keysize); err = -ENOKEY; goto out_release_key; } switch (ci->ci_policy.version) { case FSCRYPT_POLICY_V1: err = fscrypt_setup_v1_file_key(ci, mk->mk_secret.raw); break; case FSCRYPT_POLICY_V2: err = fscrypt_setup_v2_file_key(ci, mk); break; default: WARN_ON(1); err = -EINVAL; break; } if (err) goto out_release_key; *master_key_ret = key; return 0; out_release_key: up_read(&mk->mk_secret_sem); key_put(key); return err; } static void put_crypt_info(struct fscrypt_info *ci) { struct key *key; if (!ci) return; if (ci->ci_direct_key) { fscrypt_put_direct_key(ci->ci_direct_key); } else if ((ci->ci_ctfm != NULL || ci->ci_essiv_tfm != NULL) && !fscrypt_is_direct_key_policy(&ci->ci_policy)) { crypto_free_skcipher(ci->ci_ctfm); crypto_free_cipher(ci->ci_essiv_tfm); } key = ci->ci_master_key; if (key) { struct fscrypt_master_key *mk = key->payload.data[0]; /* * Remove this inode from the list of inodes that were unlocked * with the master key. * * In addition, if we're removing the last inode from a key that * already had its secret removed, invalidate the key so that it * gets removed from ->s_master_keys. */ spin_lock(&mk->mk_decrypted_inodes_lock); list_del(&ci->ci_master_key_link); spin_unlock(&mk->mk_decrypted_inodes_lock); if (refcount_dec_and_test(&mk->mk_refcount)) key_invalidate(key); key_put(key); } kmem_cache_free(fscrypt_info_cachep, ci); } int fscrypt_get_encryption_info(struct inode *inode) { struct fscrypt_info *crypt_info; union fscrypt_context ctx; struct fscrypt_mode *mode; struct key *master_key = NULL; int res; if (fscrypt_has_encryption_key(inode)) return 0; res = fscrypt_initialize(inode->i_sb->s_cop->flags); if (res) return res; res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); if (res < 0) { if (!fscrypt_dummy_context_enabled(inode) || IS_ENCRYPTED(inode)) { fscrypt_warn(inode, "Error %d getting encryption context", res); return res; } /* Fake up a context for an unencrypted directory */ memset(&ctx, 0, sizeof(ctx)); ctx.version = FSCRYPT_CONTEXT_V1; ctx.v1.contents_encryption_mode = FSCRYPT_MODE_AES_256_XTS; ctx.v1.filenames_encryption_mode = FSCRYPT_MODE_AES_256_CTS; memset(ctx.v1.master_key_descriptor, 0x42, FSCRYPT_KEY_DESCRIPTOR_SIZE); res = sizeof(ctx.v1); } crypt_info = kmem_cache_zalloc(fscrypt_info_cachep, GFP_NOFS); if (!crypt_info) return -ENOMEM; crypt_info->ci_inode = inode; res = fscrypt_policy_from_context(&crypt_info->ci_policy, &ctx, res); if (res) { fscrypt_warn(inode, "Unrecognized or corrupt encryption context"); goto out; } switch (ctx.version) { case FSCRYPT_CONTEXT_V1: memcpy(crypt_info->ci_nonce, ctx.v1.nonce, FS_KEY_DERIVATION_NONCE_SIZE); break; case FSCRYPT_CONTEXT_V2: memcpy(crypt_info->ci_nonce, ctx.v2.nonce, FS_KEY_DERIVATION_NONCE_SIZE); break; default: WARN_ON(1); res = -EINVAL; goto out; } if (!fscrypt_supported_policy(&crypt_info->ci_policy, inode)) { res = -EINVAL; goto out; } mode = select_encryption_mode(&crypt_info->ci_policy, inode); if (IS_ERR(mode)) { res = PTR_ERR(mode); goto out; } WARN_ON(mode->ivsize > FSCRYPT_MAX_IV_SIZE); crypt_info->ci_mode = mode; res = setup_file_encryption_key(crypt_info, &master_key); if (res) goto out; if (cmpxchg_release(&inode->i_crypt_info, NULL, crypt_info) == NULL) { if (master_key) { struct fscrypt_master_key *mk = master_key->payload.data[0]; refcount_inc(&mk->mk_refcount); crypt_info->ci_master_key = key_get(master_key); spin_lock(&mk->mk_decrypted_inodes_lock); list_add(&crypt_info->ci_master_key_link, &mk->mk_decrypted_inodes); spin_unlock(&mk->mk_decrypted_inodes_lock); } crypt_info = NULL; } res = 0; out: if (master_key) { struct fscrypt_master_key *mk = master_key->payload.data[0]; up_read(&mk->mk_secret_sem); key_put(master_key); } if (res == -ENOKEY) res = 0; put_crypt_info(crypt_info); return res; } EXPORT_SYMBOL(fscrypt_get_encryption_info); /** * fscrypt_put_encryption_info - free most of an inode's fscrypt data * * Free the inode's fscrypt_info. Filesystems must call this when the inode is * being evicted. An RCU grace period need not have elapsed yet. */ void fscrypt_put_encryption_info(struct inode *inode) { put_crypt_info(inode->i_crypt_info); inode->i_crypt_info = NULL; } EXPORT_SYMBOL(fscrypt_put_encryption_info); /** * fscrypt_free_inode - free an inode's fscrypt data requiring RCU delay * * Free the inode's cached decrypted symlink target, if any. Filesystems must * call this after an RCU grace period, just before they free the inode. */ void fscrypt_free_inode(struct inode *inode) { if (IS_ENCRYPTED(inode) && S_ISLNK(inode->i_mode)) { kfree(inode->i_link); inode->i_link = NULL; } } EXPORT_SYMBOL(fscrypt_free_inode); /** * fscrypt_drop_inode - check whether the inode's master key has been removed * * Filesystems supporting fscrypt must call this from their ->drop_inode() * method so that encrypted inodes are evicted as soon as they're no longer in * use and their master key has been removed. * * Return: 1 if fscrypt wants the inode to be evicted now, otherwise 0 */ int fscrypt_drop_inode(struct inode *inode) { const struct fscrypt_info *ci = READ_ONCE(inode->i_crypt_info); const struct fscrypt_master_key *mk; /* * If ci is NULL, then the inode doesn't have an encryption key set up * so it's irrelevant. If ci_master_key is NULL, then the master key * was provided via the legacy mechanism of the process-subscribed * keyrings, so we don't know whether it's been removed or not. */ if (!ci || !ci->ci_master_key) return 0; mk = ci->ci_master_key->payload.data[0]; /* * With proper, non-racy use of FS_IOC_REMOVE_ENCRYPTION_KEY, all inodes * protected by the key were cleaned by sync_filesystem(). But if * userspace is still using the files, inodes can be dirtied between * then and now. We mustn't lose any writes, so skip dirty inodes here. */ if (inode->i_state & I_DIRTY_ALL) return 0; /* * Note: since we aren't holding ->mk_secret_sem, the result here can * immediately become outdated. But there's no correctness problem with * unnecessarily evicting. Nor is there a correctness problem with not * evicting while iput() is racing with the key being removed, since * then the thread removing the key will either evict the inode itself * or will correctly detect that it wasn't evicted due to the race. */ return !is_master_key_secret_present(&mk->mk_secret); } EXPORT_SYMBOL_GPL(fscrypt_drop_inode);
27.833611
123
0.710306
[ "object", "transform" ]
758d5111d4535b0cc34463ebad46877214b39809
11,797
c
C
opal/mca/hwloc/hwloc191/hwloc/src/topology-synthetic.c
afriedle-intel/ompi-release
e86824fe8973461d3f6c511657c409683edd2037
[ "BSD-3-Clause-Open-MPI" ]
null
null
null
opal/mca/hwloc/hwloc191/hwloc/src/topology-synthetic.c
afriedle-intel/ompi-release
e86824fe8973461d3f6c511657c409683edd2037
[ "BSD-3-Clause-Open-MPI" ]
null
null
null
opal/mca/hwloc/hwloc191/hwloc/src/topology-synthetic.c
afriedle-intel/ompi-release
e86824fe8973461d3f6c511657c409683edd2037
[ "BSD-3-Clause-Open-MPI" ]
1
2020-12-13T02:51:19.000Z
2020-12-13T02:51:19.000Z
/* * Copyright © 2009 CNRS * Copyright © 2009-2014 Inria. All rights reserved. * Copyright © 2009-2010 Université Bordeaux 1 * Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved. * See COPYING in top-level directory. */ #include <private/autogen/config.h> #include <hwloc.h> #include <private/private.h> #include <private/misc.h> #include <private/debug.h> #include <limits.h> #include <assert.h> #ifdef HAVE_STRINGS_H #include <strings.h> #endif struct hwloc_synthetic_level_data_s { unsigned arity; hwloc_obj_type_t type; unsigned depth; /* For caches/groups */ hwloc_obj_cache_type_t cachetype; /* For caches */ /* used while filling the topology */ unsigned next_os_index; /* id of the next object for that level */ }; struct hwloc_synthetic_backend_data_s { /* synthetic backend parameters */ char *string; #define HWLOC_SYNTHETIC_MAX_DEPTH 128 struct hwloc_synthetic_level_data_s level[HWLOC_SYNTHETIC_MAX_DEPTH]; }; /* Read from description a series of integers describing a symmetrical topology and update the hwloc_synthetic_backend_data_s accordingly. On success, return zero. */ static int hwloc_backend_synthetic_init(struct hwloc_synthetic_backend_data_s *data, const char *description) { const char *pos, *next_pos; unsigned long item, count; unsigned i; int cache_depth = 0, group_depth = 0; int nb_machine_levels = 0, nb_node_levels = 0; int nb_pu_levels = 0; int verbose = 0; char *env = getenv("HWLOC_SYNTHETIC_VERBOSE"); if (env) verbose = atoi(env); for (pos = description, count = 1; *pos; pos = next_pos) { #define HWLOC_OBJ_TYPE_UNKNOWN ((hwloc_obj_type_t) -1) hwloc_obj_type_t type = HWLOC_OBJ_TYPE_UNKNOWN; int typedepth = -1; hwloc_obj_cache_type_t cachetype = (hwloc_obj_cache_type_t) -1; while (*pos == ' ') pos++; if (!*pos) break; if (*pos < '0' || *pos > '9') { if (hwloc_obj_type_sscanf(pos, &type, &typedepth, &cachetype, sizeof(cachetype)) < 0) { if (verbose) fprintf(stderr, "Synthetic string with unknown object type at '%s'\n", pos); errno = EINVAL; return -1; } if (type == HWLOC_OBJ_MISC) { if (verbose) fprintf(stderr, "Synthetic string with disallow object type at '%s'\n", pos); errno = EINVAL; return -1; } next_pos = strchr(pos, ':'); if (!next_pos) { if (verbose) fprintf(stderr,"Synthetic string doesn't have a `:' after object type at '%s'\n", pos); errno = EINVAL; return -1; } pos = next_pos + 1; } item = strtoul(pos, (char **)&next_pos, 0); if (next_pos == pos) { if (verbose) fprintf(stderr,"Synthetic string doesn't have a number of objects at '%s'\n", pos); errno = EINVAL; return -1; } if (count + 1 >= HWLOC_SYNTHETIC_MAX_DEPTH) { if (verbose) fprintf(stderr,"Too many synthetic levels, max %d\n", HWLOC_SYNTHETIC_MAX_DEPTH); errno = EINVAL; return -1; } if (item > UINT_MAX) { if (verbose) fprintf(stderr,"Too big arity, max %u\n", UINT_MAX); errno = EINVAL; return -1; } data->level[count-1].arity = (unsigned)item; data->level[count].type = type; data->level[count].depth = (unsigned) typedepth; data->level[count].cachetype = cachetype; count++; } if (count <= 0) { if (verbose) fprintf(stderr, "Synthetic string doesn't contain any object\n"); errno = EINVAL; return -1; } for(i=count-1; i>0; i--) { struct hwloc_synthetic_level_data_s *curlevel = &data->level[i]; hwloc_obj_type_t type; type = curlevel->type; if (type == HWLOC_OBJ_TYPE_UNKNOWN) { if (i == count-1) type = HWLOC_OBJ_PU; else { switch (data->level[i+1].type) { case HWLOC_OBJ_PU: type = HWLOC_OBJ_CORE; break; case HWLOC_OBJ_CORE: type = HWLOC_OBJ_CACHE; break; case HWLOC_OBJ_CACHE: type = HWLOC_OBJ_SOCKET; break; case HWLOC_OBJ_SOCKET: type = HWLOC_OBJ_NODE; break; case HWLOC_OBJ_NODE: case HWLOC_OBJ_MACHINE: case HWLOC_OBJ_GROUP: type = HWLOC_OBJ_GROUP; break; default: assert(0); } } curlevel->type = type; } switch (type) { case HWLOC_OBJ_PU: nb_pu_levels++; break; case HWLOC_OBJ_CACHE: cache_depth++; break; case HWLOC_OBJ_GROUP: group_depth++; break; case HWLOC_OBJ_NODE: nb_node_levels++; break; case HWLOC_OBJ_MACHINE: nb_machine_levels++; break; default: break; } } if (!nb_pu_levels) { if (verbose) fprintf(stderr, "Synthetic string missing ending number of PUs\n"); errno = EINVAL; return -1; } if (nb_pu_levels > 1) { if (verbose) fprintf(stderr, "Synthetic string can not have several PU levels\n"); errno = EINVAL; return -1; } if (nb_node_levels > 1) { if (verbose) fprintf(stderr, "Synthetic string can not have several NUMA node levels\n"); errno = EINVAL; return -1; } if (nb_machine_levels > 1) { if (verbose) fprintf(stderr, "Synthetic string can not have several machine levels\n"); errno = EINVAL; return -1; } if (nb_machine_levels) data->level[0].type = HWLOC_OBJ_SYSTEM; else { data->level[0].type = HWLOC_OBJ_MACHINE; nb_machine_levels++; } if (cache_depth == 1) /* if there is a single cache level, make it L2 */ cache_depth = 2; for (i=0; i<count; i++) { struct hwloc_synthetic_level_data_s *curlevel = &data->level[i]; hwloc_obj_type_t type = curlevel->type; if (type == HWLOC_OBJ_GROUP) { if (curlevel->depth == (unsigned)-1) curlevel->depth = group_depth--; } else if (type == HWLOC_OBJ_CACHE) { if (curlevel->depth == (unsigned)-1) curlevel->depth = cache_depth--; if (curlevel->cachetype == (hwloc_obj_cache_type_t) -1) curlevel->cachetype = curlevel->depth == 1 ? HWLOC_OBJ_CACHE_DATA : HWLOC_OBJ_CACHE_UNIFIED; } } data->string = strdup(description); data->level[count-1].arity = 0; return 0; } /* * Recursively build objects whose cpu start at first_cpu * - level gives where to look in the type, arity and id arrays * - the id array is used as a variable to get unique IDs for a given level. * - generated memory should be added to *memory_kB. * - generated cpus should be added to parent_cpuset. * - next cpu number to be used should be returned. */ static unsigned hwloc__look_synthetic(struct hwloc_topology *topology, struct hwloc_synthetic_backend_data_s *data, int level, unsigned first_cpu, hwloc_bitmap_t parent_cpuset) { hwloc_obj_t obj; unsigned i; struct hwloc_synthetic_level_data_s *curlevel = &data->level[level]; hwloc_obj_type_t type = curlevel->type; /* pre-hooks */ switch (type) { case HWLOC_OBJ_GROUP: break; case HWLOC_OBJ_SYSTEM: case HWLOC_OBJ_BRIDGE: case HWLOC_OBJ_PCI_DEVICE: case HWLOC_OBJ_OS_DEVICE: /* Shouldn't happen. */ abort(); break; case HWLOC_OBJ_MACHINE: break; case HWLOC_OBJ_NODE: break; case HWLOC_OBJ_SOCKET: break; case HWLOC_OBJ_CACHE: break; case HWLOC_OBJ_CORE: break; case HWLOC_OBJ_PU: break; case HWLOC_OBJ_MISC: case HWLOC_OBJ_TYPE_MAX: /* Should never happen */ assert(0); break; } obj = hwloc_alloc_setup_object(type, curlevel->next_os_index++); obj->cpuset = hwloc_bitmap_alloc(); if (!curlevel->arity) { hwloc_bitmap_set(obj->cpuset, first_cpu++); } else { for (i = 0; i < curlevel->arity; i++) first_cpu = hwloc__look_synthetic(topology, data, level + 1, first_cpu, obj->cpuset); } if (type == HWLOC_OBJ_NODE) { obj->nodeset = hwloc_bitmap_alloc(); hwloc_bitmap_set(obj->nodeset, obj->os_index); } hwloc_bitmap_or(parent_cpuset, parent_cpuset, obj->cpuset); /* post-hooks */ switch (type) { case HWLOC_OBJ_GROUP: obj->attr->group.depth = curlevel->depth; break; case HWLOC_OBJ_SYSTEM: case HWLOC_OBJ_BRIDGE: case HWLOC_OBJ_PCI_DEVICE: case HWLOC_OBJ_OS_DEVICE: abort(); break; case HWLOC_OBJ_MACHINE: break; case HWLOC_OBJ_NODE: /* 1GB in memory nodes, 256k 4k-pages. */ obj->memory.local_memory = 1024*1024*1024; obj->memory.page_types_len = 1; obj->memory.page_types = malloc(sizeof(*obj->memory.page_types)); memset(obj->memory.page_types, 0, sizeof(*obj->memory.page_types)); obj->memory.page_types[0].size = 4096; obj->memory.page_types[0].count = 256*1024; break; case HWLOC_OBJ_SOCKET: break; case HWLOC_OBJ_CACHE: obj->attr->cache.depth = curlevel->depth; obj->attr->cache.linesize = 64; obj->attr->cache.type = curlevel->cachetype; if (obj->attr->cache.depth == 1) { /* 32Kb in L1d */ obj->attr->cache.size = 32*1024; } else { /* *4 at each level, starting from 1MB for L2, unified */ obj->attr->cache.size = 256*1024 << (2*obj->attr->cache.depth); } break; case HWLOC_OBJ_CORE: break; case HWLOC_OBJ_PU: break; case HWLOC_OBJ_MISC: case HWLOC_OBJ_TYPE_MAX: /* Should never happen */ assert(0); break; } hwloc_insert_object_by_cpuset(topology, obj); return first_cpu; } static int hwloc_look_synthetic(struct hwloc_backend *backend) { struct hwloc_topology *topology = backend->topology; struct hwloc_synthetic_backend_data_s *data = backend->private_data; hwloc_bitmap_t cpuset = hwloc_bitmap_alloc(); unsigned first_cpu = 0, i; assert(!topology->levels[0][0]->cpuset); hwloc_alloc_obj_cpusets(topology->levels[0][0]); topology->support.discovery->pu = 1; /* start with os_index 0 for each level */ for (i = 0; data->level[i].arity > 0; i++) data->level[i].next_os_index = 0; /* ... including the last one */ data->level[i].next_os_index = 0; /* update first level type according to the synthetic type array */ topology->levels[0][0]->type = data->level[0].type; for (i = 0; i < data->level[0].arity; i++) first_cpu = hwloc__look_synthetic(topology, data, 1, first_cpu, cpuset); hwloc_bitmap_free(cpuset); hwloc_obj_add_info(topology->levels[0][0], "Backend", "Synthetic"); hwloc_obj_add_info(topology->levels[0][0], "SyntheticDescription", data->string); return 1; } static void hwloc_synthetic_backend_disable(struct hwloc_backend *backend) { struct hwloc_synthetic_backend_data_s *data = backend->private_data; free(data->string); free(data); } static struct hwloc_backend * hwloc_synthetic_component_instantiate(struct hwloc_disc_component *component, const void *_data1, const void *_data2 __hwloc_attribute_unused, const void *_data3 __hwloc_attribute_unused) { struct hwloc_backend *backend; struct hwloc_synthetic_backend_data_s *data; int err; if (!_data1) { errno = EINVAL; goto out; } backend = hwloc_backend_alloc(component); if (!backend) goto out; data = malloc(sizeof(*data)); if (!data) { errno = ENOMEM; goto out_with_backend; } err = hwloc_backend_synthetic_init(data, (const char *) _data1); if (err < 0) goto out_with_data; backend->private_data = data; backend->discover = hwloc_look_synthetic; backend->disable = hwloc_synthetic_backend_disable; backend->is_thissystem = 0; return backend; out_with_data: free(data); out_with_backend: free(backend); out: return NULL; } static struct hwloc_disc_component hwloc_synthetic_disc_component = { HWLOC_DISC_COMPONENT_TYPE_GLOBAL, "synthetic", ~0, hwloc_synthetic_component_instantiate, 30, NULL }; const struct hwloc_component hwloc_synthetic_component = { HWLOC_COMPONENT_ABI, HWLOC_COMPONENT_TYPE_DISC, 0, &hwloc_synthetic_disc_component };
26.391499
93
0.669916
[ "object" ]
7594df4796fa0a5bef3a4cbbdfd08d409e58c28d
341
h
C
include/graph_zeppelin_common.h
GraphStreamingProject/GraphZeppelinCommon
75cf08e12d97a934550516b1456ffc2fa09766d2
[ "MIT" ]
null
null
null
include/graph_zeppelin_common.h
GraphStreamingProject/GraphZeppelinCommon
75cf08e12d97a934550516b1456ffc2fa09766d2
[ "MIT" ]
2
2022-01-17T19:29:00.000Z
2022-01-17T23:29:52.000Z
include/graph_zeppelin_common.h
Victor-C-Zhang/GraphZeppelinCommon
75cf08e12d97a934550516b1456ffc2fa09766d2
[ "MIT" ]
null
null
null
#pragma once #define GROUP_NAME GraphZeppelin #define BUFFERING_NAME GutterTree #include <cstdint> // graph typedef uint32_t node_id_t; // Max graph vertices is 2^32 - 1 = 4 294 967 295 typedef uint64_t edge_id_t; // Max number edges // sketching typedef uint64_t vec_t; //Max sketch vector size is 2^64 - 1 typedef uint32_t vec_hash_t;
22.733333
77
0.765396
[ "vector" ]
759f9d6668e381b88904281ae2cfb5315e94508a
2,980
h
C
src/HSpline.h
tapeguy/heekscad
e5037d15d642551de756f352e4e14505c39ad7cf
[ "BSD-3-Clause" ]
null
null
null
src/HSpline.h
tapeguy/heekscad
e5037d15d642551de756f352e4e14505c39ad7cf
[ "BSD-3-Clause" ]
null
null
null
src/HSpline.h
tapeguy/heekscad
e5037d15d642551de756f352e4e14505c39ad7cf
[ "BSD-3-Clause" ]
null
null
null
// HSpline.h // Copyright (c) 2009, Dan Heeks // This program is released under the BSD license. See the file COPYING for details. #pragma once #include "EndedObject.h" #include "../interface/PropertyList.h" // CTangentialArc is used to calculate an arc given desired start ( p0 ), end ( p1 ) and start direction ( v0 ) class CTangentialArc { private: HeeksObj * m_owner; public: gp_Pnt m_p0; // start point gp_Vec m_v0; // start direction gp_Pnt m_p1; // end point gp_Pnt m_c; // centre point gp_Dir m_a; // axis bool m_is_a_line; CTangentialArc(HeeksObj * owner, const gp_Pnt &p0, const gp_Vec &v0, const gp_Pnt &p1); bool radius_equal(const gp_Pnt &p, double tolerance) const; double radius() const; HeeksObj* MakeHArc() const; }; class HSpline : public EndedObject { private: bool spline_created; PropertyInt m_degree; PropertyCheck m_rational; PropertyCheck m_periodic; PropertyList m_knots; PropertyList m_poles; // Private no-arg constructor HSpline(); public: static const int ObjType = SplineType; Handle(Geom_BSplineCurve) m_spline; HSpline(const Geom_BSplineCurve &s, const HeeksColor& col); HSpline(const Handle_Geom_BSplineCurve s, const HeeksColor& col); HSpline(const std::list<gp_Pnt> &points, const HeeksColor& col); HSpline(const HSpline &c); ~HSpline(void); const HSpline& operator=(const HSpline &c); // HeeksObj's virtual functions void InitializeProperties(); void OnPropertySet(Property& prop); void GetProperties(std::list<Property *> *list); int GetMarkingFilter()const{return ArcMarkingFilter;} void glCommands(bool select, bool marked, bool no_color); void GetBox(CBox &box); void RedistributePoles(); HeeksObj *MakeACopy(void)const; const wxBitmap &GetIcon(); void ModifyByMatrix(const double *mat); void GetGripperPositions(std::list<GripData> *list, bool just_for_endof); bool FindNearPoint(const double* ray_start, const double* ray_direction, double *point); bool FindPossTangentPoint(const double* ray_start, const double* ray_direction, double *point); bool Stretch(const double *p, const double* shift, void* data); void GetSegments(void(*callbackfunc)(const double *p), double pixels_per_mm, bool want_start_point = true) const; int Intersects(const HeeksObj *object, std::list< double > *rl) const; static HeeksObj* ReadFromXMLElement(TiXmlElement* pElem); bool IsDifferent(HeeksObj* other); bool GetStartPoint(double* pos); bool GetEndPoint(double* pos); void ToBiarcs(std::list<HeeksObj*> &new_spans, double tolerance); static void ToBiarcs(HeeksObj * owner, const Handle_Geom_BSplineCurve s, std::list<HeeksObj*> &new_spans, double tolerance, double first_parameter, double last_parameter); void Reverse(); void GetTools(std::list<Tool*>* t_list, const wxPoint* p); wxString ToString() const; protected: static void ReadKnotsXML(Property * prop, TiXmlElement *element); static void ReadPolesXML(Property * prop, TiXmlElement *element); };
32.043011
172
0.75302
[ "object" ]
75a10e9d26677969cb4ceafdc5b83419da6fdba2
2,161
h
C
src/minami/statistics.h
AlanPi1992/MAC-POSTS
4e4ed3bb6faa5ebd0aa5059b2dfff103fe8f1961
[ "MIT" ]
18
2017-03-02T20:12:11.000Z
2022-03-11T02:38:38.000Z
src/minami/statistics.h
AlanPi1992/MAC-POSTS
4e4ed3bb6faa5ebd0aa5059b2dfff103fe8f1961
[ "MIT" ]
7
2019-02-26T04:11:49.000Z
2019-09-16T05:43:17.000Z
src/minami/statistics.h
Lemma1/MAC-POSTS
7e3d0fe2d34a2f3d1edc8c33059e9c84868bd236
[ "MIT" ]
19
2017-08-18T04:11:25.000Z
2022-03-11T02:38:43.000Z
#ifndef STATISTICS_H #define STATISTICS_H #include "Snap.h" #include "dnode.h" #include "dlink.h" #include "factory.h" #include "enum.h" #include <string> #include <iostream> #include <fstream> class MNM_Statistics { public: MNM_Statistics(std::string file_folder, MNM_ConfReader *conf_reader, MNM_ConfReader *record_config, MNM_OD_Factory *od_factory, MNM_Node_Factory *node_factory, MNM_Link_Factory *link_factory); virtual ~MNM_Statistics(); /* may or may not be initialized */ std::unordered_map<TInt, TFlt> m_load_interval_volume; std::unordered_map<TInt, TFlt> m_record_interval_volume; std::unordered_map<TInt, TFlt> m_record_interval_tt; std::unordered_map<TInt, TFlt> m_load_interval_tt; std::vector<MNM_Dlink*> m_link_order; //since iteration of the unordered_map is not guaranteed the same order, //so we keep the order first /* universal function */ int record_loading_interval_condition(TInt timestamp); int record_record_interval_condition(TInt timestamp); int virtual update_record(TInt timestamp){return 0;}; int virtual init_record(); int virtual post_record(); protected: int init_record_value(); bool m_record_volume; bool m_record_tt; std::string m_file_folder; Record_type m_record_type; MNM_ConfReader *m_self_config; MNM_ConfReader *m_global_config; MNM_OD_Factory *m_od_factory; MNM_Node_Factory *m_node_factory; MNM_Link_Factory *m_link_factory; std::ofstream m_load_interval_volume_file; std::ofstream m_record_interval_volume_file; std::ofstream m_load_interval_tt_file; std::ofstream m_record_interval_tt_file; }; class MNM_Statistics_Lrn : public MNM_Statistics { public: MNM_Statistics_Lrn(std::string file_folder, MNM_ConfReader *conf_reader, MNM_ConfReader *record_config, MNM_OD_Factory *od_factory, MNM_Node_Factory *node_factory, MNM_Link_Factory *link_factory); ~MNM_Statistics_Lrn(); int virtual update_record(TInt timestamp); int virtual init_record(); int virtual post_record(); private: TInt m_n; std::unordered_map<TInt, TFlt> m_to_be_volume; std::unordered_map<TInt, TFlt> m_to_be_tt; }; #endif
30.013889
110
0.774179
[ "vector" ]
75a3ffa49e93b09fd2888a0442b4063f44e025ee
6,956
h
C
rgbd/RGBDFrame.h
Mavericklsd/rgb_mapping_and_relocalisation
feb10285dc2694557f23096d9a89743ccf85f062
[ "MIT" ]
18
2017-04-04T09:31:32.000Z
2021-02-25T09:19:07.000Z
rgbd/RGBDFrame.h
Mavericklsd/rgb_mapping_and_relocalisation
feb10285dc2694557f23096d9a89743ccf85f062
[ "MIT" ]
1
2017-09-27T14:29:56.000Z
2017-09-27T14:29:56.000Z
rgbd/RGBDFrame.h
Mavericklsd/rgb_mapping_and_relocalisation
feb10285dc2694557f23096d9a89743ccf85f062
[ "MIT" ]
9
2017-04-01T00:14:56.000Z
2019-08-28T16:05:53.000Z
//Copyright(c) 2015 Shuda Li[lishuda1980@gmail.com] // //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 NON - INFRINGEMENT.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. #ifndef BTL_KEYFRAME #define BTL_KEYFRAME #define USE_PBO 1 #include "DllExportDef.h" namespace btl { namespace kinect { using namespace Eigen; using namespace cv; using namespace cv::cuda; class CRGBDFrame { //type public: typedef std::shared_ptr< CRGBDFrame > tp_shared_ptr; typedef CRGBDFrame* tp_ptr; enum tp_cluster { NORMAL_CLUSTER, DISTANCE_CLUSTER}; public: CRGBDFrame( btl::image::SCamera::tp_ptr pRGBCamera_, ushort uResolution_, ushort uPyrLevel_, const Eigen::Vector3f& eivCw_ ); CRGBDFrame(const CRGBDFrame::tp_ptr pFrame_); CRGBDFrame(const CRGBDFrame& Frame_); ~CRGBDFrame(); //accumulate the relative R T to the global RT void applyRelativePose( const CRGBDFrame& sReferenceKF_ ); bool isMovedwrtReferencInRadiusM(const CRGBDFrame* const pRefFrame_, double dRotAngleThreshold_, double dTranslationThreshold_); // set the opengl modelview matrix to align with the current view void getGLModelViewMatrix(Matrix4f* pModelViewGL_) const { *pModelViewGL_ = btl::utility::setModelViewGLfromRTCV ( _Rw, _Tw ); return; } Matrix4f getGLModelViewMatrix( ) const { return btl::utility::setModelViewGLfromRTCV ( _Rw, _Tw ); } void getRnt(Matrix3f* pR_, Vector3f* pt_) const { *pR_ = _Rw; *pt_ = _Tw; return; } const Matrix3f& getR() const {return _Rw;} const Vector3f& getT() const {return _Tw;} void getPrjCfW(Eigen::Affine3f* ptr_proj_cfw) { ptr_proj_cfw->setIdentity(); ptr_proj_cfw->translation() = _Tw; ptr_proj_cfw->linear() = _Rw; return; } Eigen::Affine3f getPrjCfW() const { Eigen::Affine3f prj; prj.setIdentity(); prj.linear() = _Rw; prj.translation() = _Tw; return prj; } void setRTFromC(float fXA_, float fYA_, float fZA_, float fCwX_,float fCwY_,float fCwZ_); void setRTFromC(const Matrix3f& eimRotation_, const Vector3f& eivCw_); void setRTw(const Matrix3f& eimRotation_, const Vector3f& eivTw_); void setRTFromPrjWfC(const Eigen::Affine3f& prj_wfc_); void setRTFromPrjCfW(const Eigen::Affine3f& prj_cfw_); void initRT(); void copyRTFrom(const CRGBDFrame& cFrame_ ); void assignRTfromGL(); void gpuTransformToWorld(const ushort usPyrLevel_); void gpuTransformToWorld(); // render the camera location in the GL world void renderCameraInWorld(btl::gl_util::CGLUtil::tp_ptr pGL_, bool bRenderCoordinate_, float* color_, bool bRenderCamera_, const double& dPhysicalFocalLength_, const unsigned short uLevel_); // render the depth in the GL world void render3DPtsInSurfel(btl::gl_util::CGLUtil::tp_ptr pGL_, const unsigned short uLevel_) const; void render3DPts(btl::gl_util::CGLUtil::tp_ptr pGL_,const ushort usLevel_); void gpuRender3DPts(btl::gl_util::CGLUtil::tp_ptr pGL_, const ushort usPyrLevel_); // detect the correspondences double gpuCalcRTBroxOpticalFlow ( const CRGBDFrame& sPrevFrameWorld_, const double dDistanceThreshold_, unsigned short* pInliers_); void gpuBroxOpticalFlow (const CRGBDFrame& sPrevFrameWorld_, GpuMat* pcvgmColorGraph_); // copy the content to another keyframe at void copyTo( CRGBDFrame* pKF_, const short sLevel_ ) const; void copyTo( CRGBDFrame* pKF_ ) const; void copyImageTo( CRGBDFrame* pKF_ ) const; void convert2NormalMap(); void convertDepth2Gray(float max_); void exportNormalMap(const string& file_name_) const; void exportYML(const std::string& strPath_, const std::string& strYMLName_); void importYML(const std::string& strPath_, const std::string& strYMLName_); ushort pyrHeight() {return _uPyrHeight;} private: //surf keyframe matching void allocate(); void gpuConvert2ColorGraph( GpuMat* pcvgmU_, GpuMat* pcvgmV_, GpuMat* pcvgmColorGraph_ ); float calcRTFromPair(const CRGBDFrame& sPrevKF_, const double dDistanceThreshold_, unsigned short* pInliers_); public: btl::image::SCamera::tp_ptr _pRGBCamera; //share the content of the RGBCamera with those from VideoKinectSource //host std::shared_ptr<cv::Mat> _acvmShrPtrPyrDepths[4]; std::shared_ptr<cv::Mat> _acvmShrPtrPyrPts[4]; //using pointer array is because the vector<cv::Mat> has problem when using it &vMat[0] in calling a function std::shared_ptr<cv::Mat> _acvmShrPtrPyrNls[4]; //CV_32FC3 type std::shared_ptr<cv::Mat> _acvmShrPtrPyrReliability[4]; //cpu version std::shared_ptr<cv::Mat> _acvmShrPtrPyrRGBs[4]; std::shared_ptr<cv::Mat> _acvmShrPtrPyrBWs[4]; //device std::shared_ptr<GpuMat> _acvgmShrPtrPyrDepths[4]; std::shared_ptr<GpuMat> _acvgmShrPtrPyrPts[4]; //using pointer array is because the vector<cv::Mat> has problem when using it &vMat[0] in calling a function std::shared_ptr<GpuMat> _acvgmShrPtrPyrNls[4]; //CV_32FC3 std::shared_ptr<GpuMat> _acvgmShrPtrPyrReliability[4]; //CV_32FC1 ratio = largest / smallest eigen value std::shared_ptr<GpuMat> _acvgmShrPtrPyrRGBs[4]; std::shared_ptr<GpuMat> _acvgmShrPtrPyrBWs[4]; std::shared_ptr<GpuMat> _acvgmShrPtrPyrDisparity[4]; std::shared_ptr<GpuMat> _acvgmShrPtrPyr32FC1Tmp[4]; std::shared_ptr<GpuMat> _pcvgmPrev,_pcvgmCurr,_pcvgmU,_pcvgmV; std::shared_ptr<GpuMat> _pry_mask[4]; //clusters /*static*/ std::shared_ptr<cv::Mat> _acvmShrPtrAA[4];//for rendering GpuMat _normal_map; GpuMat _depth_gray; //pose //R & T is the relative pose w.r.t. the coordinate defined in previous camera system. //R & T is defined using CV convention //R & T X_curr = R* X_prev + T; //after applying void applyRelativePose() R, T -> R_w, T_w //X_c = R_w * X_w + T_w //where _w defined in world reference system // _c defined in camera reference system (local reference system) Matrix3f _Rw; Vector3f _Tw; Vector3f _eivInitCw; Sophus::SE3<float> _T_cw; //GL ModelView Matrix //render context //btl::gl_util::CGLUtil::tp_ptr _pGL; bool _bGPURender; tp_cluster _eClusterType; private: //for surf matching //host public: ushort _uPyrHeight; ushort _uResolution; };//end of class }//utility }//btl #endif
37.804348
190
0.763514
[ "render", "vector" ]
75a6a6f59b91cec2294d40173ae49af4ab35d24e
813
h
C
xmd/include/xmd/forces/go.h
vitreusx/xmd
09f7df4b398f41f0e59abdced25998b53470f0a4
[ "MIT" ]
1
2021-12-16T02:26:30.000Z
2021-12-16T02:26:30.000Z
xmd/include/xmd/forces/go.h
vitreusx/xmd
09f7df4b398f41f0e59abdced25998b53470f0a4
[ "MIT" ]
null
null
null
xmd/include/xmd/forces/go.h
vitreusx/xmd
09f7df4b398f41f0e59abdced25998b53470f0a4
[ "MIT" ]
null
null
null
#pragma once #include <xmd/types/vec3.h> #include <xmd/model/native_contact.h> #include <xmd/model/box.h> #include <xmd/utils/math.h> #include <xmd/forces/primitives/lj.h> #include <xmd/nl/data.h> namespace xmd { class eval_go_forces { public: real depth; public: const_array<vec3r> r; array<vec3r> F; box const *box; vector<nat_cont> const *contacts; real *V; public: void iter(int idx) const; void operator()() const; void omp_async() const; }; class update_go_contacts { public: const_array<vec3r> r; box const *box; nl::nl_data const *nl; vector<nat_cont> const *all_contacts; vector<nat_cont> *contacts; public: void operator()() const; }; }
18.477273
45
0.586716
[ "vector", "model" ]
75a7766bd86ffe0abb9887258eba95df44e6110b
6,537
h
C
AllJoyn/Platform/BridgeRT/LSFConsts.h
shuWebDev/samples
4b2c23cf16bdbe58cb2beba7c202c85242419d2e
[ "MIT" ]
1,433
2015-04-30T09:26:53.000Z
2022-03-26T12:44:12.000Z
AllJoyn/Platform/BridgeRT/LSFConsts.h
LeCampusAzure/ms-iot-samples
c0da021a312a631c8a26771a0d203e0de80fc597
[ "MIT" ]
530
2015-05-02T09:12:48.000Z
2018-01-03T17:52:01.000Z
AllJoyn/Platform/BridgeRT/LSFConsts.h
LeCampusAzure/ms-iot-samples
c0da021a312a631c8a26771a0d203e0de80fc597
[ "MIT" ]
1,878
2015-04-30T04:18:57.000Z
2022-03-15T16:51:17.000Z
// // Copyright (c) 2015, Microsoft Corporation // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // #pragma once namespace BridgeRT { const char PROPERTY_VERSION_STR[] = "Version"; // Lamp Service const char PROPERTY_LAMP_SERVICE_VERSION_STR[] = "LampServiceVersion"; const char PROPERTY_LAMP_FAULTS_STR[] = "LampFaults"; // Lamp Parameters const char PROPERTY_ENERGY_USAGE_MILLIWATTS_STR[] = "Energy_Usage_Milliwatts"; const char PROPERTY_BRIGHTNESS_LUMENS_STR[] = "Brightness_Lumens"; // Lamp Details const char PROPERTY_MAKE_STR[] = "Make"; const char PROPERTY_MODEL_STR[] = "Model"; const char PROPERTY_TYPE_STR[] = "Type"; const char PROPERTY_LAMP_TYPE_STR[] = "LampType"; const char PROPERTY_LAMP_BASE_TYPE_STR[] = "LampBaseType"; const char PROPERTY_LAMP_BEAM_ANGLE_STR[] = "LampBeamAngle"; const char PROPERTY_DIMMABLE_STR[] = "Dimmable"; const char PROPERTY_COLOR_STR[] = "Color"; const char PROPERTY_VARIABLE_COLOR_TEMP_STR[] = "VariableColorTemp"; const char PROPERTY_HAS_EFFECTS_STR[] = "HasEffects"; const char PROPERTY_MIN_VOLTAGE_STR[] = "MinVoltage"; const char PROPERTY_MAX_VOLTAGE_STR[] = "MaxVoltage"; const char PROPERTY_WATTAGE_STR[] = "Wattage"; const char PROPERTY_INCANDESCENT_EQUIVALENT_STR[] = "IncandescentEquivalent"; const char PROPERTY_MAX_LUMENS_STR[] = "MaxLumens"; const char PROPERTY_MIN_TEMPERATURE_STR[] = "MinTemperature"; const char PROPERTY_MAX_TEMPERATURE_STR[] = "MaxTemperature"; const char PROPERTY_COLOR_RENDERING_INDEX_STR[] = "ColorRenderingIndex"; const char PROPERTY_LAMP_ID_STR[] = "LampID"; // Lamp State const char PROPERTY_ON_OFF_STR[] = "OnOff"; const char PROPERTY_HUE_STR[] = "Hue"; const char PROPERTY_SATURATION_STR[] = "Saturation"; const char PROPERTY_COLOR_TEMP_STR[] = "ColorTemp"; const char PROPERTY_BRIGHTNESS_STR[] = "Brightness"; // Method ClearLampFault const char METHOD_CLEAR_LAMP_FAULT_STR[] = "ClearLampFault"; const char METHOD_CLEAR_LAMP_FAULT_INPUT_SIGNATURE_STR[] = "u"; const char METHOD_CLEAR_LAMP_FAULT_OUTPUT_SIGNATURE_STR[] = "uu"; const char METHOD_CLEAR_LAMP_FAULT_ARG_NAMES_STR[] = "LampFaultCode,LampResponseCode,LampFaultCode"; const int METHOD_CLEAR_LAMP_FAULT_INPUT_COUNT = 1; const int METHOD_CLEAR_LAMP_FAULT_OUTPUT_COUNT = 2; // Method TransitionLampState const char METHOD_TRANSITION_LAMP_STATE_STR[] = "TransitionLampState"; const char METHOD_TRANSITION_LAMP_STATE_INPUT_SIGNATURE_STR[] = "ta{sv}u"; const char METHOD_TRANSITION_LAMP_STATE_OUTPUT_SIGNATURE_STR[] = "u"; const char METHOD_TRANSITION_LAMP_STATE_ARG_NAMES_STR[] = "Timestamp,NewState,TransitionPeriod,LampResponseCode"; const int METHOD_TRANSITION_LAMP_STATE_INPUT_COUNT = 3; const int METHOD_TRANSITION_LAMP_STATE_OUTPUT_COUNT = 1; //Method ApplyPulseEffect const char METHOD_APPLY_PULSE_EFFECT_STR[] = "ApplyPulseEffect"; const char METHOD_APPLY_PULSE_EFFECT_INPUT_SIGNATURE_STR[] = "a{sv}a{sv}uuut"; const char METHOD_APPLY_PULSE_EFFECT_OUTPUT_SIGNATURE_STR[] = "u"; const char METHOD_APPLY_PULSE_EFFECT_ARG_NAMES_STR[] = "FromState,ToState,period,duration,numPulses,timestamp,LampResponseCode"; const int METHOD_APPLY_PULSE_EFFECT_INPUT_COUNT = 6; const int METHOD_APPLY_PULSE_EFFECT_OUTPUT_COUNT = 1; //Signal LampStateChanged const char SIGNAL_LAMP_STATE_CHANGED_STR[] = "LampStateChanged"; const char SIGNAL_PARAMETER_LAMP_ID_STR[] = "LampID"; //Method Get (DBusProperties Interface) const char METHOD_GET_STR[] = "Get"; const char METHOD_GET_INPUT_SIGNATURE_STR[] = "ss"; const char METHOD_GET_OUTPUT_SIGNATURE_STR[] = "v"; //Method Set (DBusProperties Interface) const char METHOD_SET_STR[] = "Set"; const char METHOD_SET_INPUT_SIGNATURE_STR[] = "ssv"; //Method GetAll (DBusProperties Interface) const char METHOD_GET_ALL_STR[] = "GetAll"; const char METHOD_GET_ALL_INPUT_SIGNATURE_STR[] = "s"; const char METHOD_GET_ALL_OUTPUT_SIGNATURE_STR[] = "a{sv}"; //Bus Object Path const char LSF_BUS_OBJECT_PATH[] = "/org/allseen/LSF/Lamp"; // Interface names const char LAMP_DBUS_PROPERTIES_INTERFACE_NAME[] = "org.freedesktop.DBus.Properties"; const char LAMP_SERVICE_INTERFACE_NAME[] = "org.allseen.LSF.LampService"; const char LAMP_PARAMETERS_INTERFACE_NAME[] = "org.allseen.LSF.LampParameters"; const char LAMP_DETAILS_INTERFACE_NAME[] = "org.allseen.LSF.LampDetails"; const char LAMP_STATE_INTERFACE_NAME[] = "org.allseen.LSF.LampState"; // Lamp State Element Indices const int LAMP_STATE_ELEMENT_COUNT = 5; //OnOff, Brightness, Hue, Saturation, ColorTemp const int LAMP_STATE_ON_OFF_INDEX = 0; const int LAMP_STATE_BRIGHTNESS_INDEX = 1; const int LAMP_STATE_HUE_INDEX = 2; const int LAMP_STATE_SATURATION_INDEX = 3; const int LAMP_STATE_COLORTEMP_INDEX = 4; // Signatures const char ARG_STRING_STR[] = "s"; const char ARG_BOOLEAN_STR[] = "b"; const char ARG_UINT32_STR[] = "u"; const char ARG_UINT32_ARRY_STR[] = "au"; }
49.150376
143
0.671715
[ "object", "model" ]
75aa6f43f052c149398e68e73ffe856d8b83217c
4,802
h
C
modules/DGM/TrainLink.h
aliyasineser/DGM
87b9b70ba4eebb3ef8c330e56b15268597880f7d
[ "BSD-3-Clause" ]
null
null
null
modules/DGM/TrainLink.h
aliyasineser/DGM
87b9b70ba4eebb3ef8c330e56b15268597880f7d
[ "BSD-3-Clause" ]
null
null
null
modules/DGM/TrainLink.h
aliyasineser/DGM
87b9b70ba4eebb3ef8c330e56b15268597880f7d
[ "BSD-3-Clause" ]
null
null
null
// Base abstract class for random model links (inter-layer edges) training // Written by Sergey G. Kosov in 2016 for Project X #pragma once #include "ITrain.h" namespace DirectGraphicalModels { // ============================= Link Train Class ============================= /** * @ingroup moduleTrainEdge * @brief Base abstract class for link (inter-layer edge) potentials training * @author Sergey G. Kosov, sergey.kosov@project-10.de */ class CTrainLink : public ITrain { public: /** * @brief Constructor * @param nStatesBase Number of states (classes) for the base layer of the graphical model * @param nStatesOccl Number of states (classes) for the occlusion layer of the graphical model * @param nFeatures Number of features */ DllExport CTrainLink(byte nStatesBase, byte nStatesOccl, word nFeatures) : CBaseRandomModel(nStatesBase * nStatesOccl) , ITrain(nStatesBase * nStatesOccl, nFeatures) , m_nStatesBase(nStatesBase) , m_nStatesOccl(nStatesOccl) {} DllExport virtual ~CTrainLink(void) {} /** * @brief Adds a block of new feature vectors * @details Used to add multiple \b featureVectors, corresponding to the ground-truth states (classes) \b gtb and \b gto for training * @param featureVectors Multi-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>) * @param gtb Matrix, each element of which is a ground-truth state (class), corresponding to the base layer * @param gto Matrix, each element of which is a ground-truth state (class), corresponding to the occlusion layer */ DllExport void addFeatureVec(const Mat &featureVectors, const Mat &gtb, const Mat &gto); /** * @brief Adds a block of new feature vectors * @details Used to add multiple \b featureVectors, corresponding to the ground-truth states (classes) \b gtb and \b gto for training * @param featureVectors Vector of size \a nFeatures, each element of which is a single feature - image: Mat(type: CV_8UC1) * @param gtb Matrix, each element of which is a ground-truth state (class), corresponding to the base layer * @param gto Matrix, each element of which is a ground-truth state (class), corresponding to the occlusion layer */ DllExport void addFeatureVec(const vec_mat_t &featureVectors, const Mat &gtb, const Mat &gto); /** * @brief Adds a feature vector * @details Used to add \b featureVector, corresponding to the ground-truth states (classes) \b gtb and \b gto for training. * Here the couple \b {gtb, \b gto} corresponds to the nodes from base aod occlusion layers. * @param featureVector Multi-dimensinal point: Mat(size: nFeatures x 1; type: CV_8UC1), corresponding to both nodes of the link. * @param gtb The ground-truth state (class) of the first node of the edge, corresponding to the base layer * @param gto The ground-truth state (class) of the second node of the edge, corresponding to the occlusion layer */ DllExport virtual void addFeatureVec(const Mat &featureVector, byte gtb, byte gto) = 0; DllExport virtual void train(bool doClean = false) {} /** * @brief Returns the link potential, based on the feature vector * @details This function calls calculateLinkPotentials() function, which should be implemented in derived classes. After that, * the resulting edge potential is powered by parameter \b weight. * @param featureVector Multi-dimensinal point \f$\textbf{f}\f$: Mat(size: nFeatures x 1; type: CV_{XX}C1), corresponding to both nodes of the link * @param weight The weighting parameter * @return %Edge potentials on success: Mat(size: nStates x nStates; type: CV_32FC1) */ DllExport Mat getLinkPotentials(const Mat &featureVector, float weight = 1.0f) const; protected: /** * @brief Calculates the link potential, based on the feature vector * @details This function calculates the potentials of an edge, described with the sample \b featureVector, correspondig to the both nodes defining that edge. * The resulting potentials of the two nodes being in each possible state (one class from occlusion layer occlusion another class from the base layer), * are united in the edge potential matrix: * \f[edgePot[nStates][nStates] = f(\textbf{f}[nFeatures])\f] * Functions \f$ f \f$ must be implemented in derived classes. * @param featureVector Multi-dimensinal point \f$\textbf{f}\f$: Mat(size: nFeatures x 1; type: CV_{XX}C1), corresponding to both nodes of the link * @returns The edge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1) */ DllExport virtual Mat calculateLinkPotentials(const Mat &featureVector) const = 0; protected: byte m_nStatesBase; byte m_nStatesOccl; }; }
53.955056
160
0.717409
[ "vector", "model" ]
75aeace5df7ecae98ad26f29be53d763618eb670
1,011
h
C
src/playground/player.h
Cat-Lord/ppgso_project
fa2fc3fc16e3e20a656d87bfec865d629b197d00
[ "MIT" ]
null
null
null
src/playground/player.h
Cat-Lord/ppgso_project
fa2fc3fc16e3e20a656d87bfec865d629b197d00
[ "MIT" ]
null
null
null
src/playground/player.h
Cat-Lord/ppgso_project
fa2fc3fc16e3e20a656d87bfec865d629b197d00
[ "MIT" ]
null
null
null
#pragma once #include <ppgso/ppgso.h> #include <glm/glm.hpp> #include <vector> #include "object.h" #include "cube.h" #include "sphere.h" class Player final : public Object { float toCollect = 1; float GRAVITY = 0.05f; float TURN_SPEED = 2.3f; float TILES_LIMIT = 200; float currentSpeed = 3.5f; float currentTurn = toRads(-90); float age = 0.0f; glm::vec3 direction; float vehicleYaw = 0.0f; float maxYaw = 0.5f; float yawAmount = 0.1f; std::vector<std::unique_ptr<Cube>> tiles = std::vector<std::unique_ptr<Cube>>(); std::vector<std::unique_ptr<Sphere>> things; float widht = 0.5f, length = 1.5f; public: Player(); Player(const std::string &textureBMP); bool update(Scene &scene, float dt) override; void render(Scene &scene) override; float lerp(float from, float to, float percent); // usage ? - animation void addTile(Scene &scene); void updateTiles(Scene &scene, float dt); void drawTiles(Scene &scene); bool outOfBounds(Scene &scene); void explode(Scene &scene); };
26.605263
81
0.69634
[ "render", "object", "vector" ]
75b9761a3539cafbd15747f43cf6633365cb9221
3,543
h
C
common/inc/qcc/windows/RWLock.h
liuxiang88/core-alljoyn
549c966482d9b89da84aa528117584e7049916cb
[ "Apache-2.0" ]
33
2018-01-12T00:37:43.000Z
2022-03-24T02:31:36.000Z
common/inc/qcc/windows/RWLock.h
liuxiang88/core-alljoyn
549c966482d9b89da84aa528117584e7049916cb
[ "Apache-2.0" ]
1
2020-01-05T05:51:27.000Z
2020-01-05T05:51:27.000Z
common/inc/qcc/windows/RWLock.h
liuxiang88/core-alljoyn
549c966482d9b89da84aa528117584e7049916cb
[ "Apache-2.0" ]
30
2017-12-13T23:24:00.000Z
2022-01-25T02:11:19.000Z
/** * @file * * Define a class that abstracts Windows file locks. */ /****************************************************************************** * Copyright (c) Open Connectivity Foundation (OCF), AllJoyn Open Source * Project (AJOSP) Contributors and others. * * SPDX-License-Identifier: Apache-2.0 * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution, and is available at * http://www.apache.org/licenses/LICENSE-2.0 * * Copyright (c) Open Connectivity Foundation and Contributors to AllSeen * Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef _OS_QCC_RWLOCK_H #define _OS_QCC_RWLOCK_H #include <qcc/platform.h> #include <Status.h> namespace qcc { /** * The Windows implementation of a Rwlock abstraction class. */ class RWLock { public: /** * The constructor initializes the underlying rwlock implementation. */ RWLock() { Init(); } /** * The destructor will destroy the underlying rwlock. */ ~RWLock(); /** * Acquires a lock on the rwlock. If another thread is holding the lock, * then this function will block until the other thread has released its * lock. * * @return ER_OK if the lock was acquired, ER_INIT_FAILED if there was a * failure to initialize the lock. */ QStatus RDLock(); QStatus WRLock(); /** * Releases a lock on the rwlock. This will only release a lock for the * current thread if that thread was the one that aquired the lock in the * first place. * * @return ER_OK if the lock was released, ER_INIT_FAILED if there was a * failure to initialize the lock. */ QStatus Unlock(); /** * Attempt to acquire a lock on a rwlock. If another thread is holding the lock * this function return false otherwise the lock is acquired and the function returns true. * * @return True if the lock was acquired. */ bool TryRDLock(); bool TryWRLock(); /** * Rwlock copy constructor creates a new rwlock. */ RWLock(const RWLock&) { Init(); } /** * Rwlock assignment operator. */ RWLock& operator=(const RWLock&) { Init(); return *this; } private: SRWLOCK rwlock; ///< The Windows "slim reader/writer" (SRW) lock object. bool isInitialized; ///< true iff rwlock was successfully initialized. bool isWriteLock; ///< true if the lock is being used to write. void Init(); ///< Initialize underlying OS rwlock }; } /* namespace */ #endif
32.209091
95
0.633644
[ "object" ]
75bd3c96d4e17697348fe7a560904e523aa9fbeb
6,211
h
C
src/wallet/crypter.h
moorecoin/MooreCoinMiningAlgorithm
fe6a153e1392f6e18110b1e69481aa5c3c8b4a1d
[ "MIT" ]
null
null
null
src/wallet/crypter.h
moorecoin/MooreCoinMiningAlgorithm
fe6a153e1392f6e18110b1e69481aa5c3c8b4a1d
[ "MIT" ]
null
null
null
src/wallet/crypter.h
moorecoin/MooreCoinMiningAlgorithm
fe6a153e1392f6e18110b1e69481aa5c3c8b4a1d
[ "MIT" ]
null
null
null
// copyright (c) 2009-2014 the moorecoin core developers // distributed under the mit software license, see the accompanying // file copying or http://www.opensource.org/licenses/mit-license.php. #ifndef moorecoin_wallet_crypter_h #define moorecoin_wallet_crypter_h #include "keystore.h" #include "serialize.h" #include "support/allocators/secure.h" class uint256; const unsigned int wallet_crypto_key_size = 32; const unsigned int wallet_crypto_salt_size = 8; /** * private key encryption is done based on a cmasterkey, * which holds a salt and random encryption key. * * cmasterkeys are encrypted using aes-256-cbc using a key * derived using derivation method nderivationmethod * (0 == evp_sha512()) and derivation iterations nderiveiterations. * vchotherderivationparameters is provided for alternative algorithms * which may require more parameters (such as scrypt). * * wallet private keys are then encrypted using aes-256-cbc * with the double-sha256 of the public key as the iv, and the * master key's key as the encryption key (see keystore.[ch]). */ /** master key for wallet encryption */ class cmasterkey { public: std::vector<unsigned char> vchcryptedkey; std::vector<unsigned char> vchsalt; //! 0 = evp_sha512() //! 1 = scrypt() unsigned int nderivationmethod; unsigned int nderiveiterations; //! use this for more parameters to key derivation, //! such as the various parameters to scrypt std::vector<unsigned char> vchotherderivationparameters; add_serialize_methods; template <typename stream, typename operation> inline void serializationop(stream& s, operation ser_action, int ntype, int nversion) { readwrite(vchcryptedkey); readwrite(vchsalt); readwrite(nderivationmethod); readwrite(nderiveiterations); readwrite(vchotherderivationparameters); } cmasterkey() { // 25000 rounds is just under 0.1 seconds on a 1.86 ghz pentium m // ie slightly lower than the lowest hardware we need bother supporting nderiveiterations = 25000; nderivationmethod = 0; vchotherderivationparameters = std::vector<unsigned char>(0); } }; typedef std::vector<unsigned char, secure_allocator<unsigned char> > ckeyingmaterial; /** encryption/decryption context with key information */ class ccrypter { private: unsigned char chkey[wallet_crypto_key_size]; unsigned char chiv[wallet_crypto_key_size]; bool fkeyset; public: bool setkeyfrompassphrase(const securestring &strkeydata, const std::vector<unsigned char>& chsalt, const unsigned int nrounds, const unsigned int nderivationmethod); bool encrypt(const ckeyingmaterial& vchplaintext, std::vector<unsigned char> &vchciphertext); bool decrypt(const std::vector<unsigned char>& vchciphertext, ckeyingmaterial& vchplaintext); bool setkey(const ckeyingmaterial& chnewkey, const std::vector<unsigned char>& chnewiv); void cleankey() { memory_cleanse(chkey, sizeof(chkey)); memory_cleanse(chiv, sizeof(chiv)); fkeyset = false; } ccrypter() { fkeyset = false; // try to keep the key data out of swap (and be a bit over-careful to keep the iv that we don't even use out of swap) // note that this does nothing about suspend-to-disk (which will put all our key data on disk) // note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process. lockedpagemanager::instance().lockrange(&chkey[0], sizeof chkey); lockedpagemanager::instance().lockrange(&chiv[0], sizeof chiv); } ~ccrypter() { cleankey(); lockedpagemanager::instance().unlockrange(&chkey[0], sizeof chkey); lockedpagemanager::instance().unlockrange(&chiv[0], sizeof chiv); } }; /** keystore which keeps the private keys encrypted. * it derives from the basic key store, which is used if no encryption is active. */ class ccryptokeystore : public cbasickeystore { private: cryptedkeymap mapcryptedkeys; ckeyingmaterial vmasterkey; //! if fusecrypto is true, mapkeys must be empty //! if fusecrypto is false, vmasterkey must be empty bool fusecrypto; //! keeps track of whether unlock has run a thorough check before bool fdecryptionthoroughlychecked; protected: bool setcrypted(); //! will encrypt previously unencrypted keys bool encryptkeys(ckeyingmaterial& vmasterkeyin); bool unlock(const ckeyingmaterial& vmasterkeyin); public: ccryptokeystore() : fusecrypto(false), fdecryptionthoroughlychecked(false) { } bool iscrypted() const { return fusecrypto; } bool islocked() const { if (!iscrypted()) return false; bool result; { lock(cs_keystore); result = vmasterkey.empty(); } return result; } bool lock(); virtual bool addcryptedkey(const cpubkey &vchpubkey, const std::vector<unsigned char> &vchcryptedsecret); bool addkeypubkey(const ckey& key, const cpubkey &pubkey); bool havekey(const ckeyid &address) const { { lock(cs_keystore); if (!iscrypted()) return cbasickeystore::havekey(address); return mapcryptedkeys.count(address) > 0; } return false; } bool getkey(const ckeyid &address, ckey& keyout) const; bool getpubkey(const ckeyid &address, cpubkey& vchpubkeyout) const; void getkeys(std::set<ckeyid> &setaddress) const { if (!iscrypted()) { cbasickeystore::getkeys(setaddress); return; } setaddress.clear(); cryptedkeymap::const_iterator mi = mapcryptedkeys.begin(); while (mi != mapcryptedkeys.end()) { setaddress.insert((*mi).first); mi++; } } /** * wallet status (encrypted, locked) changed. * note: called without locks held. */ boost::signals2::signal<void (ccryptokeystore* wallet)> notifystatuschanged; }; #endif // moorecoin_wallet_crypter_h
31.527919
170
0.682338
[ "vector" ]
75be7049afa325881c18d8cb12ca756a8e7b3811
3,000
h
C
cplexlpcompare/Split.h
krk/cplexlpcompare
1874c6c216f7945d0278e418923fff93b1d6adae
[ "MIT" ]
null
null
null
cplexlpcompare/Split.h
krk/cplexlpcompare
1874c6c216f7945d0278e418923fff93b1d6adae
[ "MIT" ]
null
null
null
cplexlpcompare/Split.h
krk/cplexlpcompare
1874c6c216f7945d0278e418923fff93b1d6adae
[ "MIT" ]
null
null
null
// Copyright (c) 2014 Kerem KAT // // 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. // // Do not hesisate to contact me about usage of the code or to make comments // about the code. Your feedback will be appreciated. // // http://dissipatedheat.com/ // http://github.com/krk/ #ifndef SPLIT_H #define SPLIT_H #include <vector> #include <functional> #include <sstream> #include <iostream> #include <bitset> #include <string> #include <set> #include <boost/algorithm/string.hpp> /** \file Split.h Defines static string split functions. */ static std::set<std::string> &split( const std::string &s, char delim, std::set<std::string> &elems, std::function<bool(const std::string&)> predicate) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { if (predicate == nullptr || predicate(item)) elems.insert(item); } return elems; } static std::set<std::string> &split(const std::string &s, char delim, std::set<std::string> &elems) { return split(s, delim, elems, nullptr); } static std::vector<std::string> &split( const std::string &s, char delim, std::vector<std::string> &elems, std::function<bool(const std::string&)> predicate) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { if (predicate == nullptr || predicate(item)) elems.push_back(item); } return elems; } static std::vector<std::string> &split( std::string &s, std::string delims, std::vector<std::string> &elems, std::function<bool(const std::string&)> predicate) { boost::trim_if(s, boost::is_any_of(delims)); boost::split(elems, s, boost::is_any_of(delims)); return elems; } static std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { return split(s, delim, elems, nullptr); } static std::vector<std::string> split(const std::string &s, char delim) { std::vector<std::string> elems; split(s, delim, elems); return elems; } #endif // SPLIT_H
29.70297
107
0.715333
[ "vector" ]
5552d2c0dcee82c47423b47a6cdea92425a158aa
437
h
C
include/Dynamic/Log/LogReader.h
grievejia/tpa
8a7aa4c7d41c266fcf3a5e2011ff324bcddf5816
[ "MIT" ]
16
2016-08-03T12:09:19.000Z
2022-02-20T08:22:12.000Z
include/Dynamic/Log/LogReader.h
grievejia/tpa
8a7aa4c7d41c266fcf3a5e2011ff324bcddf5816
[ "MIT" ]
1
2016-12-14T08:42:19.000Z
2016-12-21T08:21:20.000Z
include/Dynamic/Log/LogReader.h
grievejia/tpa
8a7aa4c7d41c266fcf3a5e2011ff324bcddf5816
[ "MIT" ]
6
2016-08-19T14:17:06.000Z
2019-08-05T08:34:47.000Z
#pragma once #include "Dynamic/Log/LogRecord.h" #include <experimental/optional> #include <fstream> #include <vector> namespace dynamic { class EagerLogReader { public: EagerLogReader() = delete; static std::vector<LogRecord> readLogFromFile(const char* fileName); }; class LazyLogReader { private: std::ifstream ifs; public: LazyLogReader(const char* fileName); std::experimental::optional<LogRecord> readLogRecord(); }; }
14.096774
69
0.750572
[ "vector" ]
555b32f2f4275365a0c8e95f49fbc8f8892d750b
66,373
c
C
selection.c
r-c-f/foot
1dabc10494ac6626398c99507b791a21b923a616
[ "MIT" ]
null
null
null
selection.c
r-c-f/foot
1dabc10494ac6626398c99507b791a21b923a616
[ "MIT" ]
null
null
null
selection.c
r-c-f/foot
1dabc10494ac6626398c99507b791a21b923a616
[ "MIT" ]
null
null
null
#include "selection.h" #include <ctype.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <wctype.h> #include <sys/epoll.h> #include <sys/timerfd.h> #define LOG_MODULE "selection" #define LOG_ENABLE_DBG 0 #include "log.h" #include "async.h" #include "commands.h" #include "config.h" #include "extract.h" #include "grid.h" #include "misc.h" #include "render.h" #include "uri.h" #include "util.h" #include "vt.h" #include "xmalloc.h" static const char *const mime_type_map[] = { [DATA_OFFER_MIME_UNSET] = NULL, [DATA_OFFER_MIME_TEXT_PLAIN] = "text/plain", [DATA_OFFER_MIME_TEXT_UTF8] = "text/plain;charset=utf-8", [DATA_OFFER_MIME_URI_LIST] = "text/uri-list", [DATA_OFFER_MIME_TEXT_TEXT] = "TEXT", [DATA_OFFER_MIME_TEXT_STRING] = "STRING", [DATA_OFFER_MIME_TEXT_UTF8_STRING] = "UTF8_STRING", }; bool selection_on_rows(const struct terminal *term, int row_start, int row_end) { LOG_DBG("on rows: %d-%d, range: %d-%d (offset=%d)", term->selection.start.row, term->selection.end.row, row_start, row_end, term->grid->offset); if (term->selection.end.row < 0) return false; xassert(term->selection.start.row != -1); row_start += term->grid->offset; row_end += term->grid->offset; const struct coord *start = &term->selection.start; const struct coord *end = &term->selection.end; if ((row_start <= start->row && row_end >= start->row) || (row_start <= end->row && row_end >= end->row)) { /* The range crosses one of the selection boundaries */ return true; } /* For the last check we must ensure start <= end */ if (start->row > end->row) { const struct coord *tmp = start; start = end; end = tmp; } if (row_start >= start->row && row_end <= end->row) { LOG_INFO("ON ROWS"); return true; } return false; } void selection_view_up(struct terminal *term, int new_view) { if (likely(term->selection.start.row < 0)) return; if (likely(new_view < term->grid->view)) return; term->selection.start.row += term->grid->num_rows; if (term->selection.end.row >= 0) term->selection.end.row += term->grid->num_rows; } void selection_view_down(struct terminal *term, int new_view) { if (likely(term->selection.start.row < 0)) return; if (likely(new_view > term->grid->view)) return; term->selection.start.row &= term->grid->num_rows - 1; if (term->selection.end.row >= 0) term->selection.end.row &= term->grid->num_rows - 1; } static void foreach_selected_normal( struct terminal *term, struct coord _start, struct coord _end, bool (*cb)(struct terminal *term, struct row *row, struct cell *cell, int col, void *data), void *data) { const struct coord *start = &_start; const struct coord *end = &_end; int start_row, end_row; int start_col, end_col; if (start->row < end->row) { start_row = start->row; end_row = end->row; start_col = start->col; end_col = end->col; } else if (start->row > end->row) { start_row = end->row; end_row = start->row; start_col = end->col; end_col = start->col; } else { start_row = end_row = start->row; start_col = min(start->col, end->col); end_col = max(start->col, end->col); } for (int r = start_row; r <= end_row; r++) { size_t real_r = r & (term->grid->num_rows - 1); struct row *row = term->grid->rows[real_r]; xassert(row != NULL); for (int c = start_col; c <= (r == end_row ? end_col : term->cols - 1); c++) { if (!cb(term, row, &row->cells[c], c, data)) return; } start_col = 0; } } static void foreach_selected_block( struct terminal *term, struct coord _start, struct coord _end, bool (*cb)(struct terminal *term, struct row *row, struct cell *cell, int col, void *data), void *data) { const struct coord *start = &_start; const struct coord *end = &_end; struct coord top_left = { .row = min(start->row, end->row), .col = min(start->col, end->col), }; struct coord bottom_right = { .row = max(start->row, end->row), .col = max(start->col, end->col), }; for (int r = top_left.row; r <= bottom_right.row; r++) { size_t real_r = r & (term->grid->num_rows - 1); struct row *row = term->grid->rows[real_r]; xassert(row != NULL); for (int c = top_left.col; c <= bottom_right.col; c++) { if (!cb(term, row, &row->cells[c], c, data)) return; } } } static void foreach_selected( struct terminal *term, struct coord start, struct coord end, bool (*cb)(struct terminal *term, struct row *row, struct cell *cell, int col, void *data), void *data) { switch (term->selection.kind) { case SELECTION_CHAR_WISE: case SELECTION_WORD_WISE: case SELECTION_LINE_WISE: foreach_selected_normal(term, start, end, cb, data); return; case SELECTION_BLOCK: foreach_selected_block(term, start, end, cb, data); return; case SELECTION_NONE: break; } BUG("Invalid selection kind"); } static bool extract_one_const_wrapper(struct terminal *term, struct row *row, struct cell *cell, int col, void *data) { return extract_one(term, row, cell, col, data); } char * selection_to_text(const struct terminal *term) { if (term->selection.end.row == -1) return NULL; struct extraction_context *ctx = extract_begin(term->selection.kind, true); if (ctx == NULL) return NULL; foreach_selected( (struct terminal *)term, term->selection.start, term->selection.end, &extract_one_const_wrapper, ctx); char *text; return extract_finish(ctx, &text, NULL) ? text : NULL; } void selection_find_word_boundary_left(struct terminal *term, struct coord *pos, bool spaces_only) { const struct row *r = grid_row_in_view(term->grid, pos->row); wchar_t c = r->cells[pos->col].wc; while (c >= CELL_SPACER) { xassert(pos->col > 0); if (pos->col == 0) return; pos->col--; c = r->cells[pos->col].wc; } if (c >= CELL_COMB_CHARS_LO && c < (CELL_COMB_CHARS_LO + term->composed_count)) { c = term->composed[c - CELL_COMB_CHARS_LO].base; } bool initial_is_space = c == 0 || iswspace(c); bool initial_is_delim = !initial_is_space && !isword(c, spaces_only, term->conf->word_delimiters); bool initial_is_word = c != 0 && isword(c, spaces_only, term->conf->word_delimiters); while (true) { int next_col = pos->col - 1; int next_row = pos->row; const struct row *row = grid_row_in_view(term->grid, next_row); /* Linewrap */ if (next_col < 0) { next_col = term->cols - 1; if (--next_row < 0) break; row = grid_row_in_view(term->grid, next_row); if (row->linebreak) { /* Hard linebreak, treat as space. I.e. break selection */ break; } } c = row->cells[next_col].wc; while (c >= CELL_SPACER) { xassert(next_col > 0); if (--next_col < 0) return; c = row->cells[next_col].wc; } if (c >= CELL_COMB_CHARS_LO && c < (CELL_COMB_CHARS_LO + term->composed_count)) { c = term->composed[c - CELL_COMB_CHARS_LO].base; } bool is_space = c == 0 || iswspace(c); bool is_delim = !is_space && !isword(c, spaces_only, term->conf->word_delimiters); bool is_word = c != 0 && isword(c, spaces_only, term->conf->word_delimiters); if (initial_is_space && !is_space) break; if (initial_is_delim && !is_delim) break; if (initial_is_word && !is_word) break; pos->col = next_col; pos->row = next_row; } } void selection_find_word_boundary_right(struct terminal *term, struct coord *pos, bool spaces_only) { const struct row *r = grid_row_in_view(term->grid, pos->row); wchar_t c = r->cells[pos->col].wc; while (c >= CELL_SPACER) { xassert(pos->col > 0); if (pos->col == 0) return; pos->col--; c = r->cells[pos->col].wc; } if (c >= CELL_COMB_CHARS_LO && c < (CELL_COMB_CHARS_LO + term->composed_count)) { c = term->composed[c - CELL_COMB_CHARS_LO].base; } bool initial_is_space = c == 0 || iswspace(c); bool initial_is_delim = !initial_is_space && !isword(c, spaces_only, term->conf->word_delimiters); bool initial_is_word = c != 0 && isword(c, spaces_only, term->conf->word_delimiters); while (true) { int next_col = pos->col + 1; int next_row = pos->row; const struct row *row = grid_row_in_view(term->grid, next_row); /* Linewrap */ if (next_col >= term->cols) { if (row->linebreak) { /* Hard linebreak, treat as space. I.e. break selection */ break; } next_col = 0; if (++next_row >= term->rows) break; row = grid_row_in_view(term->grid, next_row); } c = row->cells[next_col].wc; while (c >= CELL_SPACER) { if (++next_col >= term->cols) { next_col = 0; if (++next_row >= term->rows) return; } c = row->cells[next_col].wc; } if (c >= CELL_COMB_CHARS_LO && c < (CELL_COMB_CHARS_LO + term->composed_count)) { c = term->composed[c - CELL_COMB_CHARS_LO].base; } bool is_space = c == 0 || iswspace(c); bool is_delim = !is_space && !isword(c, spaces_only, term->conf->word_delimiters); bool is_word = c != 0 && isword(c, spaces_only, term->conf->word_delimiters); if (initial_is_space && !is_space) break; if (initial_is_delim && !is_delim) break; if (initial_is_word && !is_word) break; pos->col = next_col; pos->row = next_row; } } void selection_start(struct terminal *term, int col, int row, enum selection_kind kind, bool spaces_only) { selection_cancel(term); LOG_DBG("%s selection started at %d,%d", kind == SELECTION_CHAR_WISE ? "character-wise" : kind == SELECTION_WORD_WISE ? "word-wise" : kind == SELECTION_LINE_WISE ? "line-wise" : kind == SELECTION_BLOCK ? "block" : "<unknown>", row, col); term->selection.kind = kind; term->selection.ongoing = true; term->selection.spaces_only = spaces_only; switch (kind) { case SELECTION_CHAR_WISE: case SELECTION_BLOCK: term->selection.start = (struct coord){col, term->grid->view + row}; term->selection.end = (struct coord){-1, -1}; term->selection.pivot.start = term->selection.start; term->selection.pivot.end = term->selection.end; break; case SELECTION_WORD_WISE: { struct coord start = {col, row}, end = {col, row}; selection_find_word_boundary_left(term, &start, spaces_only); selection_find_word_boundary_right(term, &end, spaces_only); term->selection.start = (struct coord){ start.col, term->grid->view + start.row}; term->selection.pivot.start = term->selection.start; term->selection.pivot.end = (struct coord){end.col, term->grid->view + end.row}; selection_update(term, end.col, end.row); break; } case SELECTION_LINE_WISE: term->selection.start = (struct coord){0, term->grid->view + row}; term->selection.pivot.start = term->selection.start; term->selection.pivot.end = (struct coord){term->cols - 1, term->grid->view + row}; selection_update(term, term->cols - 1, row); break; case SELECTION_NONE: BUG("Invalid selection kind"); break; } } /* Context used while (un)marking selected cells, to be able to * exclude empty cells */ struct mark_context { const struct row *last_row; int empty_count; }; static bool unmark_selected(struct terminal *term, struct row *row, struct cell *cell, int col, void *data) { if (cell->attrs.selected == 0 || (cell->attrs.selected & 2)) { /* Ignore if already deselected, or if premarked for updated selection */ return true; } row->dirty = true; cell->attrs.selected = 0; cell->attrs.clean = 0; return true; } static bool premark_selected(struct terminal *term, struct row *row, struct cell *cell, int col, void *data) { struct mark_context *ctx = data; xassert(ctx != NULL); if (ctx->last_row != row) { ctx->last_row = row; ctx->empty_count = 0; } if (cell->wc == 0 && term->selection.kind != SELECTION_BLOCK) { ctx->empty_count++; return true; } /* Tell unmark to leave this be */ for (int i = 0; i < ctx->empty_count + 1; i++) row->cells[col - i].attrs.selected |= 2; ctx->empty_count = 0; return true; } static bool mark_selected(struct terminal *term, struct row *row, struct cell *cell, int col, void *data) { struct mark_context *ctx = data; xassert(ctx != NULL); if (ctx->last_row != row) { ctx->last_row = row; ctx->empty_count = 0; } if (cell->wc == 0 && term->selection.kind != SELECTION_BLOCK) { ctx->empty_count++; return true; } for (int i = 0; i < ctx->empty_count + 1; i++) { struct cell *c = &row->cells[col - i]; if (c->attrs.selected & 1) c->attrs.selected = 1; /* Clear the pre-mark bit */ else { row->dirty = true; c->attrs.selected = 1; c->attrs.clean = 0; } } ctx->empty_count = 0; return true; } static void selection_modify(struct terminal *term, struct coord start, struct coord end) { xassert(term->selection.start.row != -1); xassert(start.row != -1 && start.col != -1); xassert(end.row != -1 && end.col != -1); struct mark_context ctx = {0}; /* Premark all cells that *will* be selected */ foreach_selected(term, start, end, &premark_selected, &ctx); memset(&ctx, 0, sizeof(ctx)); if (term->selection.end.row >= 0) { /* Unmark previous selection, ignoring cells that are part of * the new selection */ foreach_selected(term, term->selection.start, term->selection.end, &unmark_selected, &ctx); memset(&ctx, 0, sizeof(ctx)); } term->selection.start = start; term->selection.end = end; /* Mark new selection */ foreach_selected(term, start, end, &mark_selected, &ctx); render_refresh(term); } static void set_pivot_point_for_block_and_char_wise(struct terminal *term, struct coord start, enum selection_direction new_direction) { struct coord *pivot_start = &term->selection.pivot.start; struct coord *pivot_end = &term->selection.pivot.end; *pivot_start = start; /* First, make sure ‘start’ isn’t in the middle of a * multi-column character */ while (true) { const struct row *row = term->grid->rows[pivot_start->row & (term->grid->num_rows - 1)]; const struct cell *cell = &row->cells[pivot_start->col]; if (cell->wc < CELL_SPACER) break; /* Multi-column chars don’t cross rows */ xassert(pivot_start->col > 0); if (pivot_start->col == 0) break; pivot_start->col--; } /* * Setup pivot end to be one character *before* start * Which one we move, the end or start point, depends * on the initial selection direction. */ *pivot_end = *pivot_start; if (new_direction == SELECTION_RIGHT) { bool keep_going = true; while (keep_going) { const struct row *row = term->grid->rows[pivot_end->row & (term->grid->num_rows - 1)]; const wchar_t wc = row->cells[pivot_end->col].wc; keep_going = wc >= CELL_SPACER; if (pivot_end->col == 0) { if (pivot_end->row - term->grid->view <= 0) break; pivot_end->col = term->cols - 1; pivot_end->row--; } else pivot_end->col--; } } else { bool keep_going = true; while (keep_going) { const struct row *row = term->grid->rows[pivot_start->row & (term->grid->num_rows - 1)]; const wchar_t wc = pivot_start->col < term->cols - 1 ? row->cells[pivot_start->col + 1].wc : 0; keep_going = wc >= CELL_SPACER; if (pivot_start->col >= term->cols - 1) { if (pivot_start->row - term->grid->view >= term->rows - 1) break; pivot_start->col = 0; pivot_start->row++; } else pivot_start->col++; } } xassert(term->grid->rows[pivot_start->row & (term->grid->num_rows - 1)]-> cells[pivot_start->col].wc <= CELL_SPACER); xassert(term->grid->rows[pivot_end->row & (term->grid->num_rows - 1)]-> cells[pivot_end->col].wc <= CELL_SPACER + 1); } void selection_update(struct terminal *term, int col, int row) { if (term->selection.start.row < 0) return; if (!term->selection.ongoing) return; LOG_DBG("selection updated: start = %d,%d, end = %d,%d -> %d, %d", term->selection.start.row, term->selection.start.col, term->selection.end.row, term->selection.end.col, row, col); xassert(term->grid->view + row != -1); struct coord new_start = term->selection.start; struct coord new_end = {col, term->grid->view + row}; /* Adjust start point if the selection has changed 'direction' */ if (!(new_end.row == new_start.row && new_end.col == new_start.col)) { enum selection_direction new_direction = term->selection.direction; struct coord *pivot_start = &term->selection.pivot.start; struct coord *pivot_end = &term->selection.pivot.end; if (term->selection.kind == SELECTION_BLOCK) { if (new_end.col > pivot_start->col) new_direction = SELECTION_RIGHT; else new_direction = SELECTION_LEFT; if (term->selection.direction == SELECTION_UNDIR) set_pivot_point_for_block_and_char_wise(term, *pivot_start, new_direction); if (new_direction == SELECTION_LEFT) new_start = *pivot_end; else new_start = *pivot_start; term->selection.direction = new_direction; } else { if (new_end.row < pivot_start->row || (new_end.row == pivot_start->row && new_end.col < pivot_start->col)) { /* New end point is before the start point */ new_direction = SELECTION_LEFT; } else { /* The new end point is after the start point */ new_direction = SELECTION_RIGHT; } if (term->selection.direction != new_direction) { if (term->selection.direction == SELECTION_UNDIR && pivot_end->row < 0) { set_pivot_point_for_block_and_char_wise( term, *pivot_start, new_direction); } if (new_direction == SELECTION_LEFT) { xassert(pivot_end->row >= 0); new_start = *pivot_end; } else new_start = *pivot_start; term->selection.direction = new_direction; } } } switch (term->selection.kind) { case SELECTION_CHAR_WISE: case SELECTION_BLOCK: break; case SELECTION_WORD_WISE: switch (term->selection.direction) { case SELECTION_LEFT: { struct coord end = {col, row}; selection_find_word_boundary_left( term, &end, term->selection.spaces_only); new_end = (struct coord){end.col, term->grid->view + end.row}; break; } case SELECTION_RIGHT: { struct coord end = {col, row}; selection_find_word_boundary_right( term, &end, term->selection.spaces_only); new_end = (struct coord){end.col, term->grid->view + end.row}; break; } case SELECTION_UNDIR: break; } break; case SELECTION_LINE_WISE: switch (term->selection.direction) { case SELECTION_LEFT: new_end.col = 0; break; case SELECTION_RIGHT: new_end.col = term->cols - 1; break; case SELECTION_UNDIR: break; } break; case SELECTION_NONE: BUG("Invalid selection kind"); break; } size_t start_row_idx = new_start.row & (term->grid->num_rows - 1); size_t end_row_idx = new_end.row & (term->grid->num_rows - 1); const struct row *row_start = term->grid->rows[start_row_idx]; const struct row *row_end = term->grid->rows[end_row_idx]; /* If an end point is in the middle of a multi-column character, * expand the selection to cover the entire character */ if (new_start.row < new_end.row || (new_start.row == new_end.row && new_start.col <= new_end.col)) { while (new_start.col >= 1 && row_start->cells[new_start.col].wc >= CELL_SPACER) new_start.col--; while (new_end.col < term->cols - 1 && row_end->cells[new_end.col + 1].wc >= CELL_SPACER) new_end.col++; } else { while (new_end.col >= 1 && row_end->cells[new_end.col].wc >= CELL_SPACER) new_end.col--; while (new_start.col < term->cols - 1 && row_start->cells[new_start.col + 1].wc >= CELL_SPACER) new_start.col++; } selection_modify(term, new_start, new_end); } void selection_dirty_cells(struct terminal *term) { if (term->selection.start.row < 0 || term->selection.end.row < 0) return; foreach_selected( term, term->selection.start, term->selection.end, &mark_selected, &(struct mark_context){0}); } static void selection_extend_normal(struct terminal *term, int col, int row, enum selection_kind new_kind) { const struct coord *start = &term->selection.start; const struct coord *end = &term->selection.end; if (start->row > end->row || (start->row == end->row && start->col > end->col)) { const struct coord *tmp = start; start = end; end = tmp; } xassert(start->row < end->row || start->col < end->col); struct coord new_start, new_end; enum selection_direction direction; if (row < start->row || (row == start->row && col < start->col)) { /* Extend selection to start *before* current start */ new_start = *end; new_end = (struct coord){col, row}; direction = SELECTION_LEFT; } else if (row > end->row || (row == end->row && col > end->col)) { /* Extend selection to end *after* current end */ new_start = *start; new_end = (struct coord){col, row}; direction = SELECTION_RIGHT; } else { /* Shrink selection from start or end, depending on which one is closest */ const int linear = row * term->cols + col; if (abs(linear - (start->row * term->cols + start->col)) < abs(linear - (end->row * term->cols + end->col))) { /* Move start point */ new_start = *end; new_end = (struct coord){col, row}; direction = SELECTION_LEFT; } else { /* Move end point */ new_start = *start; new_end = (struct coord){col, row}; direction = SELECTION_RIGHT; } } switch (term->selection.kind) { case SELECTION_CHAR_WISE: xassert(new_kind == SELECTION_CHAR_WISE); set_pivot_point_for_block_and_char_wise(term, new_start, direction); break; case SELECTION_WORD_WISE: { xassert(new_kind == SELECTION_CHAR_WISE || new_kind == SELECTION_WORD_WISE); struct coord pivot_start = {new_start.col, new_start.row - term->grid->view}; struct coord pivot_end = pivot_start; selection_find_word_boundary_left( term, &pivot_start, term->selection.spaces_only); selection_find_word_boundary_right( term, &pivot_end, term->selection.spaces_only); term->selection.pivot.start = (struct coord){pivot_start.col, term->grid->view + pivot_start.row}; term->selection.pivot.end = (struct coord){pivot_end.col, term->grid->view + pivot_end.row}; break; } case SELECTION_LINE_WISE: xassert(new_kind == SELECTION_CHAR_WISE || new_kind == SELECTION_LINE_WISE); term->selection.pivot.start = (struct coord){0, new_start.row}; term->selection.pivot.end = (struct coord){term->cols - 1, new_start.row}; break; case SELECTION_BLOCK: case SELECTION_NONE: BUG("Invalid selection kind in this context"); break; } term->selection.kind = new_kind; term->selection.direction = direction; selection_modify(term, new_start, new_end); } static void selection_extend_block(struct terminal *term, int col, int row) { const struct coord *start = &term->selection.start; const struct coord *end = &term->selection.end; struct coord top_left = { .row = min(start->row, end->row), .col = min(start->col, end->col), }; struct coord top_right = { .row = min(start->row, end->row), .col = max(start->col, end->col), }; struct coord bottom_left = { .row = max(start->row, end->row), .col = min(start->col, end->col), }; struct coord bottom_right = { .row = max(start->row, end->row), .col = max(start->col, end->col), }; struct coord new_start; struct coord new_end; enum selection_direction direction = SELECTION_UNDIR; if (row <= top_left.row || abs(row - top_left.row) < abs(row - bottom_left.row)) { /* Move one of the top corners */ if (abs(col - top_left.col) < abs(col - top_right.col)) { new_start = bottom_right; new_end = (struct coord){col, row}; } else { new_start = bottom_left; new_end = (struct coord){col, row}; } } else { /* Move one of the bottom corners */ if (abs(col - bottom_left.col) < abs(col - bottom_right.col)) { new_start = top_right; new_end = (struct coord){col, row}; } else { new_start = top_left; new_end = (struct coord){col, row}; } } direction = col > new_start.col ? SELECTION_RIGHT : SELECTION_LEFT; set_pivot_point_for_block_and_char_wise(term, new_start, direction); term->selection.direction = direction; selection_modify(term, new_start, new_end); } void selection_extend(struct seat *seat, struct terminal *term, int col, int row, enum selection_kind new_kind) { if (term->selection.start.row < 0 || term->selection.end.row < 0) { /* No existing selection */ return; } if (term->selection.kind == SELECTION_BLOCK && new_kind != SELECTION_BLOCK) return; term->selection.ongoing = true; row += term->grid->view; if ((row == term->selection.start.row && col == term->selection.start.col) || (row == term->selection.end.row && col == term->selection.end.col)) { /* Extension point *is* one of the current end points */ return; } switch (term->selection.kind) { case SELECTION_NONE: BUG("Invalid selection kind"); return; case SELECTION_CHAR_WISE: case SELECTION_WORD_WISE: case SELECTION_LINE_WISE: selection_extend_normal(term, col, row, new_kind); break; case SELECTION_BLOCK: selection_extend_block(term, col, row); break; } } //static const struct zwp_primary_selection_source_v1_listener primary_selection_source_listener; void selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial) { if (!term->selection.ongoing) return; LOG_DBG("selection finalize"); selection_stop_scroll_timer(term); term->selection.ongoing = false; if (term->selection.start.row < 0 || term->selection.end.row < 0) return; xassert(term->selection.start.row != -1); xassert(term->selection.end.row != -1); if (term->selection.start.row > term->selection.end.row || (term->selection.start.row == term->selection.end.row && term->selection.start.col > term->selection.end.col)) { struct coord tmp = term->selection.start; term->selection.start = term->selection.end; term->selection.end = tmp; } xassert(term->selection.start.row <= term->selection.end.row); switch (term->conf->selection_target) { case SELECTION_TARGET_NONE: break; case SELECTION_TARGET_PRIMARY: selection_to_primary(seat, term, serial); break; case SELECTION_TARGET_CLIPBOARD: selection_to_clipboard(seat, term, serial); break; case SELECTION_TARGET_BOTH: selection_to_primary(seat, term, serial); selection_to_clipboard(seat, term, serial); break; } } void selection_cancel(struct terminal *term) { LOG_DBG("selection cancelled: start = %d,%d end = %d,%d", term->selection.start.row, term->selection.start.col, term->selection.end.row, term->selection.end.col); selection_stop_scroll_timer(term); if (term->selection.start.row >= 0 && term->selection.end.row >= 0) { foreach_selected( term, term->selection.start, term->selection.end, &unmark_selected, &(struct mark_context){0}); render_refresh(term); } term->selection.kind = SELECTION_NONE; term->selection.start = (struct coord){-1, -1}; term->selection.end = (struct coord){-1, -1}; term->selection.pivot.start = (struct coord){-1, -1}; term->selection.pivot.end = (struct coord){-1, -1}; term->selection.direction = SELECTION_UNDIR; term->selection.ongoing = false; } bool selection_clipboard_has_data(const struct seat *seat) { return seat->clipboard.data_offer != NULL; } bool selection_primary_has_data(const struct seat *seat) { return seat->primary.data_offer != NULL; } void selection_clipboard_unset(struct seat *seat) { struct wl_clipboard *clipboard = &seat->clipboard; if (clipboard->data_source == NULL) return; /* Kill previous data source */ xassert(clipboard->serial != 0); wl_data_device_set_selection(seat->data_device, NULL, clipboard->serial); wl_data_source_destroy(clipboard->data_source); clipboard->data_source = NULL; clipboard->serial = 0; free(clipboard->text); clipboard->text = NULL; } void selection_primary_unset(struct seat *seat) { struct wl_primary *primary = &seat->primary; if (primary->data_source == NULL) return; xassert(primary->serial != 0); zwp_primary_selection_device_v1_set_selection( seat->primary_selection_device, NULL, primary->serial); zwp_primary_selection_source_v1_destroy(primary->data_source); primary->data_source = NULL; primary->serial = 0; free(primary->text); primary->text = NULL; } static bool fdm_scroll_timer(struct fdm *fdm, int fd, int events, void *data) { if (events & EPOLLHUP) return false; struct terminal *term = data; uint64_t expiration_count; ssize_t ret = read( term->selection.auto_scroll.fd, &expiration_count, sizeof(expiration_count)); if (ret < 0) { if (errno == EAGAIN) return true; LOG_ERRNO("failed to read selection scroll timer"); return false; } switch (term->selection.auto_scroll.direction) { case SELECTION_SCROLL_NOT: return true; case SELECTION_SCROLL_UP: cmd_scrollback_up(term, expiration_count); selection_update(term, term->selection.auto_scroll.col, 0); break; case SELECTION_SCROLL_DOWN: cmd_scrollback_down(term, expiration_count); selection_update(term, term->selection.auto_scroll.col, term->rows - 1); break; } return true; } void selection_start_scroll_timer(struct terminal *term, int interval_ns, enum selection_scroll_direction direction, int col) { xassert(direction != SELECTION_SCROLL_NOT); if (!term->selection.ongoing) return; if (term->selection.auto_scroll.fd < 0) { int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); if (fd < 0) { LOG_ERRNO("failed to create selection scroll timer"); goto err; } if (!fdm_add(term->fdm, fd, EPOLLIN, &fdm_scroll_timer, term)) { close(fd); return; } term->selection.auto_scroll.fd = fd; } struct itimerspec timer; if (timerfd_gettime(term->selection.auto_scroll.fd, &timer) < 0) { LOG_ERRNO("failed to get current selection scroll timer value"); goto err; } if (timer.it_value.tv_sec == 0 && timer.it_value.tv_nsec == 0) timer.it_value.tv_nsec = 1; timer.it_interval.tv_sec = interval_ns / 1000000000; timer.it_interval.tv_nsec = interval_ns % 1000000000; if (timerfd_settime(term->selection.auto_scroll.fd, 0, &timer, NULL) < 0) { LOG_ERRNO("failed to set new selection scroll timer value"); goto err; } term->selection.auto_scroll.direction = direction; term->selection.auto_scroll.col = col; return; err: selection_stop_scroll_timer(term); return; } void selection_stop_scroll_timer(struct terminal *term) { if (term->selection.auto_scroll.fd < 0) { xassert(term->selection.auto_scroll.direction == SELECTION_SCROLL_NOT); return; } fdm_del(term->fdm, term->selection.auto_scroll.fd); term->selection.auto_scroll.fd = -1; term->selection.auto_scroll.direction = SELECTION_SCROLL_NOT; } static void target(void *data, struct wl_data_source *wl_data_source, const char *mime_type) { LOG_DBG("TARGET: mime-type=%s", mime_type); } struct clipboard_send { char *data; size_t len; size_t idx; }; static bool fdm_send(struct fdm *fdm, int fd, int events, void *data) { struct clipboard_send *ctx = data; if (events & EPOLLHUP) goto done; switch (async_write(fd, ctx->data, ctx->len, &ctx->idx)) { case ASYNC_WRITE_REMAIN: return true; case ASYNC_WRITE_DONE: break; case ASYNC_WRITE_ERR: LOG_ERRNO( "failed to asynchronously write %zu of selection data to FD=%d", ctx->len - ctx->idx, fd); break; } done: fdm_del(fdm, fd); free(ctx->data); free(ctx); return true; } static void send_clipboard_or_primary(struct seat *seat, int fd, const char *selection, const char *source_name) { /* Make it NONBLOCK:ing right away - we don't want to block if the * initial attempt to send the data synchronously fails */ int flags; if ((flags = fcntl(fd, F_GETFL)) < 0 || fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) { LOG_ERRNO("failed to set O_NONBLOCK"); return; } size_t len = strlen(selection); size_t async_idx = 0; switch (async_write(fd, selection, len, &async_idx)) { case ASYNC_WRITE_REMAIN: { struct clipboard_send *ctx = xmalloc(sizeof(*ctx)); *ctx = (struct clipboard_send) { .data = xstrdup(&selection[async_idx]), .len = len - async_idx, .idx = 0, }; if (fdm_add(seat->wayl->fdm, fd, EPOLLOUT, &fdm_send, ctx)) return; free(ctx->data); free(ctx); break; } case ASYNC_WRITE_DONE: break; case ASYNC_WRITE_ERR: LOG_ERRNO("failed write %zu bytes of %s selection data to FD=%d", len, source_name, fd); break; } close(fd); } static void send(void *data, struct wl_data_source *wl_data_source, const char *mime_type, int32_t fd) { struct seat *seat = data; const struct wl_clipboard *clipboard = &seat->clipboard; xassert(clipboard->text != NULL); send_clipboard_or_primary(seat, fd, clipboard->text, "clipboard"); } static void cancelled(void *data, struct wl_data_source *wl_data_source) { struct seat *seat = data; struct wl_clipboard *clipboard = &seat->clipboard; xassert(clipboard->data_source == wl_data_source); wl_data_source_destroy(clipboard->data_source); clipboard->data_source = NULL; clipboard->serial = 0; free(clipboard->text); clipboard->text = NULL; } /* We don’t support dragging *from* */ static void dnd_drop_performed(void *data, struct wl_data_source *wl_data_source) { //LOG_DBG("DnD drop performed"); } static void dnd_finished(void *data, struct wl_data_source *wl_data_source) { //LOG_DBG("DnD finished"); } static void action(void *data, struct wl_data_source *wl_data_source, uint32_t dnd_action) { //LOG_DBG("DnD action: %u", dnd_action); } static const struct wl_data_source_listener data_source_listener = { .target = &target, .send = &send, .cancelled = &cancelled, .dnd_drop_performed = &dnd_drop_performed, .dnd_finished = &dnd_finished, .action = &action, }; static void primary_send(void *data, struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, const char *mime_type, int32_t fd) { struct seat *seat = data; const struct wl_primary *primary = &seat->primary; xassert(primary->text != NULL); send_clipboard_or_primary(seat, fd, primary->text, "primary"); } static void primary_cancelled(void *data, struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1) { struct seat *seat = data; struct wl_primary *primary = &seat->primary; zwp_primary_selection_source_v1_destroy(primary->data_source); primary->data_source = NULL; primary->serial = 0; free(primary->text); primary->text = NULL; } static const struct zwp_primary_selection_source_v1_listener primary_selection_source_listener = { .send = &primary_send, .cancelled = &primary_cancelled, }; bool text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t serial) { struct wl_clipboard *clipboard = &seat->clipboard; if (clipboard->data_source != NULL) { /* Kill previous data source */ xassert(clipboard->serial != 0); wl_data_device_set_selection(seat->data_device, NULL, clipboard->serial); wl_data_source_destroy(clipboard->data_source); free(clipboard->text); clipboard->data_source = NULL; clipboard->serial = 0; clipboard->text = NULL; } clipboard->data_source = wl_data_device_manager_create_data_source(term->wl->data_device_manager); if (clipboard->data_source == NULL) { LOG_ERR("failed to create clipboard data source"); return false; } clipboard->text = text; /* Configure source */ wl_data_source_offer(clipboard->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_UTF8]); wl_data_source_offer(clipboard->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_PLAIN]); wl_data_source_offer(clipboard->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_TEXT]);; wl_data_source_offer(clipboard->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_STRING]); wl_data_source_offer(clipboard->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_UTF8_STRING]); wl_data_source_add_listener(clipboard->data_source, &data_source_listener, seat); wl_data_device_set_selection(seat->data_device, clipboard->data_source, serial); /* Needed when sending the selection to other client */ xassert(serial != 0); clipboard->serial = serial; return true; } void selection_to_clipboard(struct seat *seat, struct terminal *term, uint32_t serial) { if (term->selection.start.row < 0 || term->selection.end.row < 0) return; /* Get selection as a string */ char *text = selection_to_text(term); if (!text_to_clipboard(seat, term, text, serial)) free(text); } struct clipboard_receive { int read_fd; int timeout_fd; struct itimerspec timeout; bool bracketed; void (*decoder)(struct clipboard_receive *ctx, char *data, size_t size); void (*finish)(struct clipboard_receive *ctx); /* URI state */ bool add_space; struct { char *data; size_t sz; size_t idx; } buf; /* Callback data */ void (*cb)(char *data, size_t size, void *user); void (*done)(void *user); void *user; }; static void clipboard_receive_done(struct fdm *fdm, struct clipboard_receive *ctx) { fdm_del(fdm, ctx->timeout_fd); fdm_del(fdm, ctx->read_fd); ctx->done(ctx->user); free(ctx->buf.data); free(ctx); } static bool fdm_receive_timeout(struct fdm *fdm, int fd, int events, void *data) { struct clipboard_receive *ctx = data; if (events & EPOLLHUP) return false; xassert(events & EPOLLIN); uint64_t expire_count; ssize_t ret = read(fd, &expire_count, sizeof(expire_count)); if (ret < 0) { if (errno == EAGAIN) return true; LOG_ERRNO("failed to read clipboard timeout timer"); return false; } LOG_WARN("no data received from clipboard in %llu seconds, aborting", (unsigned long long)ctx->timeout.it_value.tv_sec); clipboard_receive_done(fdm, ctx); return true; } static void fdm_receive_decoder_plain(struct clipboard_receive *ctx, char *data, size_t size) { ctx->cb(data, size, ctx->user); } static void fdm_receive_finish_plain(struct clipboard_receive *ctx) { } static bool decode_one_uri(struct clipboard_receive *ctx, char *uri, size_t len) { LOG_DBG("URI: \"%.*s\"", (int)len, uri); if (len == 0) return false; char *scheme, *host, *path; if (!uri_parse(uri, len, &scheme, NULL, NULL, &host, NULL, &path, NULL, NULL)) { LOG_ERR("drag-and-drop: invalid URI: %.*s", (int)len, uri); return false; } if (ctx->add_space) ctx->cb(" ", 1, ctx->user); ctx->add_space = true; if (strcmp(scheme, "file") == 0 && hostname_is_localhost(host)) { ctx->cb("'", 1, ctx->user); ctx->cb(path, strlen(path), ctx->user); ctx->cb("'", 1, ctx->user); } else ctx->cb(uri, len, ctx->user); free(scheme); free(host); free(path); return true; } static void fdm_receive_decoder_uri(struct clipboard_receive *ctx, char *data, size_t size) { while (ctx->buf.idx + size > ctx->buf.sz) { size_t new_sz = ctx->buf.sz == 0 ? size : 2 * ctx->buf.sz; ctx->buf.data = xrealloc(ctx->buf.data, new_sz); ctx->buf.sz = new_sz; } memcpy(&ctx->buf.data[ctx->buf.idx], data, size); ctx->buf.idx += size; char *start = ctx->buf.data; char *end = NULL; while (true) { for (end = start; end < &ctx->buf.data[ctx->buf.idx]; end++) { if (*end == '\r' || *end == '\n') break; } if (end >= &ctx->buf.data[ctx->buf.idx]) break; decode_one_uri(ctx, start, end - start); start = end + 1; } const size_t ofs = start - ctx->buf.data; const size_t left = ctx->buf.idx - ofs; memmove(&ctx->buf.data[0], &ctx->buf.data[ofs], left); ctx->buf.idx = left; } static void fdm_receive_finish_uri(struct clipboard_receive *ctx) { LOG_DBG("finish: %.*s", (int)ctx->buf.idx, ctx->buf.data); decode_one_uri(ctx, ctx->buf.data, ctx->buf.idx); } static bool fdm_receive(struct fdm *fdm, int fd, int events, void *data) { struct clipboard_receive *ctx = data; if ((events & EPOLLHUP) && !(events & EPOLLIN)) goto done; /* Reset timeout timer */ if (timerfd_settime(ctx->timeout_fd, 0, &ctx->timeout, NULL) < 0) { LOG_ERRNO("failed to re-arm clipboard timeout timer"); return false; } /* Read until EOF */ while (true) { char text[256]; ssize_t count = read(fd, text, sizeof(text)); if (count == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) return true; LOG_ERRNO("failed to read clipboard data"); break; } if (count == 0) break; /* * Call cb while at same time replace: * - \r\n -> \r * - \n -> \r * - C0 -> <nothing> (strip non-formatting C0 characters) * - \e -> <nothing> (i.e. strip ESC) */ char *p = text; size_t left = count; #define skip_one() \ do { \ ctx->decoder(ctx, p, i); \ xassert(i + 1 <= left); \ p += i + 1; \ left -= i + 1; \ } while (0) again: for (size_t i = 0; i < left; i++) { switch (p[i]) { default: break; case '\n': if (!ctx->bracketed) p[i] = '\r'; break; case '\r': /* Convert \r\n -> \r */ if (!ctx->bracketed && i + 1 < left && p[i + 1] == '\n') { i++; skip_one(); goto again; } break; /* C0 non-formatting control characters (\b \t \n \r excluded) */ case '\x01': case '\x02': case '\x03': case '\x04': case '\x05': case '\x06': case '\x07': case '\x0e': case '\x0f': case '\x10': case '\x11': case '\x12': case '\x13': case '\x14': case '\x15': case '\x16': case '\x17': case '\x18': case '\x19': case '\x1a': case '\x1b': case '\x1c': case '\x1d': case '\x1e': case '\x1f': skip_one(); goto again; /* Additional control characters stripped by default (but * configurable) in XTerm: BS, HT, DEL */ case '\b': case '\t': case '\v': case '\f': case '\x7f': if (!ctx->bracketed) { skip_one(); goto again; } break; } } ctx->decoder(ctx, p, left); left = 0; } #undef skip_one done: ctx->finish(ctx); clipboard_receive_done(fdm, ctx); return true; } static void begin_receive_clipboard(struct terminal *term, int read_fd, enum data_offer_mime_type mime_type, void (*cb)(char *data, size_t size, void *user), void (*done)(void *user), void *user) { int timeout_fd = -1; struct clipboard_receive *ctx = NULL; int flags; if ((flags = fcntl(read_fd, F_GETFL)) < 0 || fcntl(read_fd, F_SETFL, flags | O_NONBLOCK) < 0) { LOG_ERRNO("failed to set O_NONBLOCK"); goto err; } timeout_fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC); if (timeout_fd < 0) { LOG_ERRNO("failed to create clipboard timeout timer FD"); goto err; } const struct itimerspec timeout = {.it_value = {.tv_sec = 2}}; if (timerfd_settime(timeout_fd, 0, &timeout, NULL) < 0) { LOG_ERRNO("failed to arm clipboard timeout timer"); goto err; } ctx = xmalloc(sizeof(*ctx)); *ctx = (struct clipboard_receive) { .read_fd = read_fd, .timeout_fd = timeout_fd, .timeout = timeout, .bracketed = term->bracketed_paste, .decoder = (mime_type == DATA_OFFER_MIME_URI_LIST ? &fdm_receive_decoder_uri : &fdm_receive_decoder_plain), .finish = (mime_type == DATA_OFFER_MIME_URI_LIST ? &fdm_receive_finish_uri : &fdm_receive_finish_plain), .cb = cb, .done = done, .user = user, }; if (!fdm_add(term->fdm, read_fd, EPOLLIN, &fdm_receive, ctx) || !fdm_add(term->fdm, timeout_fd, EPOLLIN, &fdm_receive_timeout, ctx)) { goto err; } return; err: free(ctx); fdm_del(term->fdm, timeout_fd); fdm_del(term->fdm, read_fd); done(user); } void text_from_clipboard(struct seat *seat, struct terminal *term, void (*cb)(char *data, size_t size, void *user), void (*done)(void *user), void *user) { struct wl_clipboard *clipboard = &seat->clipboard; if (clipboard->data_offer == NULL || clipboard->mime_type == DATA_OFFER_MIME_UNSET) { done(user); return; } /* Prepare a pipe the other client can write its selection to us */ int fds[2]; if (pipe2(fds, O_CLOEXEC) == -1) { LOG_ERRNO("failed to create pipe"); done(user); return; } LOG_DBG("receive from clipboard: mime-type=%s", mime_type_map[clipboard->mime_type]); int read_fd = fds[0]; int write_fd = fds[1]; /* Give write-end of pipe to other client */ wl_data_offer_receive( clipboard->data_offer, mime_type_map[clipboard->mime_type], write_fd); /* Don't keep our copy of the write-end open (or we'll never get EOF) */ close(write_fd); begin_receive_clipboard(term, read_fd, clipboard->mime_type, cb, done, user); } static void receive_offer(char *data, size_t size, void *user) { struct terminal *term = user; xassert(term->is_sending_paste_data); term_paste_data_to_slave(term, data, size); } static void receive_offer_done(void *user) { struct terminal *term = user; if (term->bracketed_paste) term_paste_data_to_slave(term, "\033[201~", 6); term->is_sending_paste_data = false; /* Make sure we send any queued up non-paste data */ if (tll_length(term->ptmx_buffers) > 0) fdm_event_add(term->fdm, term->ptmx, EPOLLOUT); } void selection_from_clipboard(struct seat *seat, struct terminal *term, uint32_t serial) { if (term->is_sending_paste_data) { /* We're already pasting... */ return; } struct wl_clipboard *clipboard = &seat->clipboard; if (clipboard->data_offer == NULL) return; term->is_sending_paste_data = true; if (term->bracketed_paste) term_paste_data_to_slave(term, "\033[200~", 6); text_from_clipboard(seat, term, &receive_offer, &receive_offer_done, term); } bool text_to_primary(struct seat *seat, struct terminal *term, char *text, uint32_t serial) { if (term->wl->primary_selection_device_manager == NULL) return false; struct wl_primary *primary = &seat->primary; /* TODO: somehow share code with the clipboard equivalent */ if (seat->primary.data_source != NULL) { /* Kill previous data source */ xassert(primary->serial != 0); zwp_primary_selection_device_v1_set_selection( seat->primary_selection_device, NULL, primary->serial); zwp_primary_selection_source_v1_destroy(primary->data_source); free(primary->text); primary->data_source = NULL; primary->serial = 0; primary->text = NULL; } primary->data_source = zwp_primary_selection_device_manager_v1_create_source( term->wl->primary_selection_device_manager); if (primary->data_source == NULL) { LOG_ERR("failed to create clipboard data source"); return false; } /* Get selection as a string */ primary->text = text; /* Configure source */ zwp_primary_selection_source_v1_offer(primary->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_UTF8]); zwp_primary_selection_source_v1_offer(primary->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_PLAIN]); zwp_primary_selection_source_v1_offer(primary->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_TEXT]); zwp_primary_selection_source_v1_offer(primary->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_STRING]); zwp_primary_selection_source_v1_offer(primary->data_source, mime_type_map[DATA_OFFER_MIME_TEXT_UTF8_STRING]); zwp_primary_selection_source_v1_add_listener(primary->data_source, &primary_selection_source_listener, seat); zwp_primary_selection_device_v1_set_selection(seat->primary_selection_device, primary->data_source, serial); /* Needed when sending the selection to other client */ primary->serial = serial; return true; } void selection_to_primary(struct seat *seat, struct terminal *term, uint32_t serial) { if (term->wl->primary_selection_device_manager == NULL) return; /* Get selection as a string */ char *text = selection_to_text(term); if (!text_to_primary(seat, term, text, serial)) free(text); } void text_from_primary( struct seat *seat, struct terminal *term, void (*cb)(char *data, size_t size, void *user), void (*done)(void *user), void *user) { if (term->wl->primary_selection_device_manager == NULL) { done(user); return; } struct wl_primary *primary = &seat->primary; if (primary->data_offer == NULL || primary->mime_type == DATA_OFFER_MIME_UNSET) { done(user); return; } /* Prepare a pipe the other client can write its selection to us */ int fds[2]; if (pipe2(fds, O_CLOEXEC) == -1) { LOG_ERRNO("failed to create pipe"); done(user); return; } LOG_DBG("receive from primary: mime-type=%s", mime_type_map[primary->mime_type]); int read_fd = fds[0]; int write_fd = fds[1]; /* Give write-end of pipe to other client */ zwp_primary_selection_offer_v1_receive( primary->data_offer, mime_type_map[primary->mime_type], write_fd); /* Don't keep our copy of the write-end open (or we'll never get EOF) */ close(write_fd); begin_receive_clipboard(term, read_fd, primary->mime_type, cb, done, user); } void selection_from_primary(struct seat *seat, struct terminal *term) { if (term->wl->primary_selection_device_manager == NULL) return; if (term->is_sending_paste_data) { /* We're already pasting... */ return; } struct wl_primary *primary = &seat->primary; if (primary->data_offer == NULL) return; term->is_sending_paste_data = true; if (term->bracketed_paste) term_paste_data_to_slave(term, "\033[200~", 6); text_from_primary(seat, term, &receive_offer, &receive_offer_done, term); } static void select_mime_type_for_offer(const char *_mime_type, enum data_offer_mime_type *type) { enum data_offer_mime_type mime_type = DATA_OFFER_MIME_UNSET; /* Translate offered mime type to our mime type enum */ for (size_t i = 0; i < ALEN(mime_type_map); i++) { if (mime_type_map[i] == NULL) continue; if (strcmp(_mime_type, mime_type_map[i]) == 0) { mime_type = i; break; } } LOG_DBG("mime-type: %s -> %s (offered type was %s)", mime_type_map[*type], mime_type_map[mime_type], _mime_type); /* Mime-type transition; if the new mime-type is "better" than * previously offered types, use the new type */ switch (mime_type) { case DATA_OFFER_MIME_TEXT_PLAIN: case DATA_OFFER_MIME_TEXT_TEXT: case DATA_OFFER_MIME_TEXT_STRING: /* text/plain is our least preferred type. Only use if current * type is unset */ switch (*type) { case DATA_OFFER_MIME_UNSET: *type = mime_type; break; default: break; } break; case DATA_OFFER_MIME_TEXT_UTF8: case DATA_OFFER_MIME_TEXT_UTF8_STRING: /* text/plain;charset=utf-8 is preferred over text/plain */ switch (*type) { case DATA_OFFER_MIME_UNSET: case DATA_OFFER_MIME_TEXT_PLAIN: case DATA_OFFER_MIME_TEXT_TEXT: case DATA_OFFER_MIME_TEXT_STRING: *type = mime_type; break; default: break; } break; case DATA_OFFER_MIME_URI_LIST: /* text/uri-list is always used when offered */ *type = mime_type; break; case DATA_OFFER_MIME_UNSET: break; } } static void data_offer_reset(struct wl_clipboard *clipboard) { if (clipboard->data_offer != NULL) { wl_data_offer_destroy(clipboard->data_offer); clipboard->data_offer = NULL; } clipboard->window = NULL; clipboard->mime_type = DATA_OFFER_MIME_UNSET; } static void offer(void *data, struct wl_data_offer *wl_data_offer, const char *mime_type) { struct seat *seat = data; select_mime_type_for_offer(mime_type, &seat->clipboard.mime_type); } static void source_actions(void *data, struct wl_data_offer *wl_data_offer, uint32_t source_actions) { #if defined(_DEBUG) && LOG_ENABLE_DBG char actions_as_string[1024]; size_t idx = 0; actions_as_string[0] = '\0'; actions_as_string[sizeof(actions_as_string) - 1] = '\0'; for (size_t i = 0; i < 31; i++) { if (((source_actions >> i) & 1) == 0) continue; enum wl_data_device_manager_dnd_action action = 1 << i; const char *s = NULL; switch (action) { case WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE: s = NULL; break; case WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY: s = "copy"; break; case WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE: s = "move"; break; case WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK: s = "ask"; break; } if (s == NULL) continue; strncat(actions_as_string, s, sizeof(actions_as_string) - idx - 1); idx += strlen(s); strncat(actions_as_string, ", ", sizeof(actions_as_string) - idx - 1); idx += 2; } /* Strip trailing ", " */ if (strlen(actions_as_string) > 2) actions_as_string[strlen(actions_as_string) - 2] = '\0'; LOG_DBG("DnD actions: %s (0x%08x)", actions_as_string, source_actions); #endif } static void offer_action(void *data, struct wl_data_offer *wl_data_offer, uint32_t dnd_action) { #if defined(_DEBUG) && LOG_ENABLE_DBG const char *s = NULL; switch (dnd_action) { case WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE: s = "<none>"; break; case WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY: s = "copy"; break; case WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE: s = "move"; break; case WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK: s = "ask"; break; } LOG_DBG("DnD offer action: %s (0x%08x)", s, dnd_action); #endif } static const struct wl_data_offer_listener data_offer_listener = { .offer = &offer, .source_actions = &source_actions, .action = &offer_action, }; static void data_offer(void *data, struct wl_data_device *wl_data_device, struct wl_data_offer *offer) { struct seat *seat = data; data_offer_reset(&seat->clipboard); seat->clipboard.data_offer = offer; wl_data_offer_add_listener(offer, &data_offer_listener, seat); } static void enter(void *data, struct wl_data_device *wl_data_device, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer) { struct seat *seat = data; struct wayland *wayl = seat->wayl; xassert(offer == seat->clipboard.data_offer); /* Remember _which_ terminal the current DnD offer is targeting */ xassert(seat->clipboard.window == NULL); tll_foreach(wayl->terms, it) { if (term_surface_kind(it->item, surface) == TERM_SURF_GRID && !it->item->is_sending_paste_data) { wl_data_offer_accept( offer, serial, mime_type_map[seat->clipboard.mime_type]); wl_data_offer_set_actions( offer, WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY, WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY); seat->clipboard.window = it->item->window; return; } } /* Either terminal is already busy sending paste data, or mouse * pointer isn’t over the grid */ seat->clipboard.window = NULL; wl_data_offer_set_actions(offer, 0, 0); } static void leave(void *data, struct wl_data_device *wl_data_device) { struct seat *seat = data; seat->clipboard.window = NULL; } static void motion(void *data, struct wl_data_device *wl_data_device, uint32_t time, wl_fixed_t x, wl_fixed_t y) { } struct dnd_context { struct terminal *term; struct wl_data_offer *data_offer; }; static void receive_dnd(char *data, size_t size, void *user) { struct dnd_context *ctx = user; receive_offer(data, size, ctx->term); } static void receive_dnd_done(void *user) { struct dnd_context *ctx = user; wl_data_offer_finish(ctx->data_offer); wl_data_offer_destroy(ctx->data_offer); receive_offer_done(ctx->term); free(ctx); } static void drop(void *data, struct wl_data_device *wl_data_device) { struct seat *seat = data; xassert(seat->clipboard.window != NULL); struct terminal *term = seat->clipboard.window->term; struct wl_clipboard *clipboard = &seat->clipboard; struct dnd_context *ctx = xmalloc(sizeof(*ctx)); *ctx = (struct dnd_context){ .term = term, .data_offer = clipboard->data_offer, }; /* Prepare a pipe the other client can write its selection to us */ int fds[2]; if (pipe2(fds, O_CLOEXEC) == -1) { LOG_ERRNO("failed to create pipe"); free(ctx); return; } int read_fd = fds[0]; int write_fd = fds[1]; LOG_DBG("DnD drop: mime-type=%s", mime_type_map[clipboard->mime_type]); /* Give write-end of pipe to other client */ wl_data_offer_receive( clipboard->data_offer, mime_type_map[clipboard->mime_type], write_fd); /* Don't keep our copy of the write-end open (or we'll never get EOF) */ close(write_fd); term->is_sending_paste_data = true; if (term->bracketed_paste) term_paste_data_to_slave(term, "\033[200~", 6); begin_receive_clipboard( term, read_fd, clipboard->mime_type, &receive_dnd, &receive_dnd_done, ctx); /* data offer is now “owned” by the receive context */ clipboard->data_offer = NULL; clipboard->mime_type = DATA_OFFER_MIME_UNSET; } static void selection(void *data, struct wl_data_device *wl_data_device, struct wl_data_offer *offer) { /* Selection offer from other client */ struct seat *seat = data; if (offer == NULL) data_offer_reset(&seat->clipboard); else xassert(offer == seat->clipboard.data_offer); } const struct wl_data_device_listener data_device_listener = { .data_offer = &data_offer, .enter = &enter, .leave = &leave, .motion = &motion, .drop = &drop, .selection = &selection, }; static void primary_offer(void *data, struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer, const char *mime_type) { LOG_DBG("primary offer: %s", mime_type); struct seat *seat = data; select_mime_type_for_offer(mime_type, &seat->primary.mime_type); } static const struct zwp_primary_selection_offer_v1_listener primary_selection_offer_listener = { .offer = &primary_offer, }; static void primary_offer_reset(struct wl_primary *primary) { if (primary->data_offer != NULL) { zwp_primary_selection_offer_v1_destroy(primary->data_offer); primary->data_offer = NULL; } primary->mime_type = DATA_OFFER_MIME_UNSET; } static void primary_data_offer(void *data, struct zwp_primary_selection_device_v1 *zwp_primary_selection_device, struct zwp_primary_selection_offer_v1 *offer) { struct seat *seat = data; primary_offer_reset(&seat->primary); seat->primary.data_offer = offer; zwp_primary_selection_offer_v1_add_listener( offer, &primary_selection_offer_listener, seat); } static void primary_selection(void *data, struct zwp_primary_selection_device_v1 *zwp_primary_selection_device, struct zwp_primary_selection_offer_v1 *offer) { /* Selection offer from other client, for primary */ struct seat *seat = data; if (offer == NULL) primary_offer_reset(&seat->primary); else xassert(seat->primary.data_offer == offer); } const struct zwp_primary_selection_device_v1_listener primary_selection_device_listener = { .data_offer = &primary_data_offer, .selection = &primary_selection, };
28.535254
113
0.60264
[ "render" ]
555f072251a9d8e792f926e5f9b6acb83c42f200
1,490
h
C
dependencies/panda/Panda3D-1.10.0-x64/include/ioPtaDatagramFloat.h
CrankySupertoon01/Toontown-2
60893d104528a8e7eb4aced5d0015f22e203466d
[ "MIT" ]
3
2018-03-09T12:07:29.000Z
2021-02-25T06:50:25.000Z
panda/src/putil/ioPtaDatagramFloat.h
Sinkay/panda3d
16bfd3750f726a8831771b81649d18d087917fd5
[ "PHP-3.01", "PHP-3.0" ]
1
2018-07-28T20:07:04.000Z
2018-07-30T18:28:34.000Z
panda/src/putil/ioPtaDatagramFloat.h
Sinkay/panda3d
16bfd3750f726a8831771b81649d18d087917fd5
[ "PHP-3.01", "PHP-3.0" ]
2
2019-12-02T01:39:10.000Z
2021-02-13T22:41:00.000Z
// Filename: ioPtaDatagramFloat.h // Created by: charles (10Jul00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef _IO_PTA_DATAGRAM_FLOAT #define _IO_PTA_DATAGRAM_FLOAT #include "pandabase.h" #include "pointerToArray.h" #include "pta_stdfloat.h" class BamReader; class BamWriter; class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// // Class : IoPtaDatagramFloat // Description : This class is used to read and write a PTA_stdfloat // from a Datagram, in support of Bam. It's not // intended to be constructed; it's just a convenient // place to scope these static methods which should be // called directly. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PUTIL IoPtaDatagramFloat { public: static void write_datagram(BamWriter *manager, Datagram &dest, CPTA_stdfloat array); static PTA_stdfloat read_datagram(BamReader *manager, DatagramIterator &source); }; typedef IoPtaDatagramFloat IPD_float; #endif // _IO_PTA_DATAGRAM_FLOAT
33.111111
86
0.595973
[ "3d" ]
5565f0f96c05cdd7d0a6bab8c16c8188da3bef29
1,010
h
C
source/utopian/core/AssimpLoader.h
simplerr/UtopianEngine
6fbafed1c379993c23d870ba252efa87514d43bc
[ "MIT" ]
62
2020-11-06T17:29:24.000Z
2022-03-21T19:21:16.000Z
source/utopian/core/AssimpLoader.h
simplerr/UtopianEngine
6fbafed1c379993c23d870ba252efa87514d43bc
[ "MIT" ]
134
2017-02-25T20:47:43.000Z
2022-03-14T06:54:58.000Z
source/utopian/core/AssimpLoader.h
simplerr/UtopianEngine
6fbafed1c379993c23d870ba252efa87514d43bc
[ "MIT" ]
6
2021-02-19T07:20:19.000Z
2021-12-27T09:07:27.000Z
#pragma once #include <string> #include <map> #include "vulkan/VulkanPrerequisites.h" #include "../external/assimp/assimp/Importer.hpp" #include "../external/assimp/assimp/material.h" #include "vulkan/Vertex.h" #include "utility/Module.h" #include "utility/Common.h" struct aiMaterial; namespace Utopian { class Model; /** * Loader supporting a lot of different file formats. * E.g .fbx, .obj, .dae, .mdl, .md2, .md3 etc. * * @note Does not load PBR materials, use .gltf models for that. * @note Does not support loading of animations */ class AssimpLoader { public: AssimpLoader(Vk::Device* device); ~AssimpLoader(); SharedPtr<Model> LoadModel(std::string filename); private: std::string GetPath(aiMaterial* material, aiTextureType textureType, std::string filename); int FindValidPath(aiString* texturePath, std::string modelPath); bool TryLongerPath(char* szTemp, aiString* p_szString); Vk::Device* mDevice; }; }
24.634146
97
0.682178
[ "model" ]
556696640665e07441a7f8e7a33d5893fbfb5c5f
5,293
h
C
framework/ywss4linkkit/libywss/utility/log.h
ghsecuritylab/Alios_SDK
edd416e7d2961db42c2100ac2d6237ee527d1aee
[ "Apache-2.0" ]
2
2021-05-28T08:25:33.000Z
2021-11-17T02:58:50.000Z
framework/ywss4linkkit/libywss/utility/log.h
ghsecuritylab/Alios_SDK
edd416e7d2961db42c2100ac2d6237ee527d1aee
[ "Apache-2.0" ]
null
null
null
framework/ywss4linkkit/libywss/utility/log.h
ghsecuritylab/Alios_SDK
edd416e7d2961db42c2100ac2d6237ee527d1aee
[ "Apache-2.0" ]
5
2018-05-23T02:56:10.000Z
2021-01-02T16:44:09.000Z
/* * Copyright (c) 2014-2016 Alibaba Group. All rights reserved. * * Alibaba Group retains all right, title and interest (including all * intellectual property rights) in and to this computer program, which is * protected by applicable intellectual property laws. Unless you have * obtained a separate written license from Alibaba Group., you are not * authorized to utilize all or a part of this computer program for any * purpose (including reproduction, distribution, modification, and * compilation into object code), and you must immediately destroy or * return to Alibaba Group all copies of this computer program. If you * are licensed by Alibaba Group, your rights to utilize this computer * program are limited by the terms of that license. To obtain a license, * please contact Alibaba Group. * * This computer program contains trade secrets owned by Alibaba Group. * and, unless unauthorized by Alibaba Group in writing, you agree to * maintain the confidentiality of this computer program and related * information and to not disclose this computer program and related * information to any other person or entity. * * THIS COMPUTER PROGRAM IS PROVIDED AS IS WITHOUT ANY WARRANTIES, AND * Alibaba Group EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, * INCLUDING THE WARRANTIES OF MERCHANTIBILITY, FITNESS FOR A PARTICULAR * PURPOSE, TITLE, AND NONINFRINGEMENT. */ #ifndef LOG_H #define LOG_H #include <stdio.h> #include "os.h" #include "lite-log.h" extern unsigned int log_level; static inline unsigned int log_get_level(void) { return log_level; } static inline void log_set_level(int level) { log_level = level; } enum LOGLEVEL_BIT { LL_NONE_BIT = -1, LL_FATAL_BIT, LL_ERROR_BIT, LL_WARN_BIT, LL_INFO_BIT, LL_DEBUG_BIT, LL_TRACE_BIT, LL_MAX_BIT }; #define LOG_LEVEL log_get_level() #define LL_NONE 0 #define LL_ALL 0XFF #define LL_FATAL (1 << LL_FATAL_BIT) #define LL_ERROR (1 << LL_ERROR_BIT) #define LL_WARN (1 << LL_WARN_BIT) #define LL_INFO (1 << LL_INFO_BIT) #define LL_DEBUG (1 << LL_DEBUG_BIT) #define LL_TRACE (1 << LL_TRACE_BIT) /* * color def. * see http://stackoverflow.com/questions/3585846/color-text-in-terminal-applications-in-unix */ /* #define COL_DEF "\x1B[0m" //white #define COL_RED "\x1B[31m" //red #define COL_GRE "\x1B[32m" //green #define COL_BLU "\x1B[34m" //blue #define COL_YEL "\x1B[33m" //yellow #define COL_WHE "\x1B[37m" //white #define COL_CYN "\x1B[36m" #define log_print(CON, MOD, COLOR, LVL, FMT, ...) \ do {\ if (CON) {\ os_printf(COLOR"<%s> [%s#%d] : ",\ LVL, __FUNCTION__, __LINE__);\ os_printf(FMT COL_DEF"\r\n", ##__VA_ARGS__);\ }\ }while(0) #define log_fatal(FMT, ...) \ log_print(LOG_LEVEL & LL_FATAL, "ALINK", COL_RED, "FATAL", FMT, ##__VA_ARGS__) #define log_error(FMT, ...) \ log_print(LOG_LEVEL & LL_ERROR, "ALINK", COL_YEL, "ERROR", FMT, ##__VA_ARGS__) #define log_warn(FMT, ...) \ log_print(LOG_LEVEL & LL_WARN, "ALINK", COL_BLU, "WARN", FMT, ##__VA_ARGS__) #define log_info(FMT, ...) \ log_print(LOG_LEVEL & LL_INFO, "ALINK", COL_GRE, "INFO", FMT, ##__VA_ARGS__) #define log_debug(FMT, ...) \ log_print(LOG_LEVEL & LL_DEBUG, "ALINK", COL_WHE, "DEBUG", FMT, ##__VA_ARGS__) #define log_trace(FMT, ...) \ log_print(LOG_LEVEL & LL_TRACE, "ALINK", COL_CYN, "TRACE", FMT, ##__VA_ARGS__) */ /******************************************/ #define CALL_FUCTION_FAILED "Call function \"%s\" failed\n" #define RET_FAILED(ret) (ret != SERVICE_RESULT_OK) #define RET_GOTO(Ret,gotoTag,strError, args...) \ {\ if ( RET_FAILED(Ret) ) \ { \ log_trace(strError, ##args); \ goto gotoTag; \ }\ } #define RET_FALSE(Ret,strError,args...) \ {\ if ( RET_FAILED(Ret) ) \ { \ log_trace(strError, ##args); \ return false; \ }\ } #define RET_RETURN(Ret,strError,args...) \ {\ if ( RET_FAILED(Ret) ) \ { \ log_trace(strError, ##args); \ return Ret; \ }\ } #define RET_LOG(Ret,strError,args...) \ {\ if ( RET_FAILED(Ret) ) \ { \ log_error(strError, ##args); \ }\ } #define PTR_RETURN(Pointer,Ret,strError,args...) \ {\ if ( !Pointer) \ { \ log_error(strError, ##args); \ return Ret; \ }\ } #define PTR_FALSE(Pointer,strError,args...) \ {\ if ( !Pointer) \ { \ log_trace(strError, ##args); \ return FALSE; \ }\ } #define PTR_LOG(Pointer,strError,args...) \ {\ if ( !Pointer) \ { \ log_error(strError, ##args); \ }\ } #define PTR_GOTO(Pointer, gotoTag, strError, args...) \ {\ if ( !Pointer) \ { \ log_trace(strError, ##args); \ goto gotoTag; \ }\ } #define POINTER_RETURN(Pointer,strError,args...) \ {\ if ( !Pointer) \ { \ log_trace(strError, ##args); \ return Pointer; \ }\ } #endif
28.005291
93
0.601738
[ "object" ]
55696d9e2fe0ea546e504aa7dfc28e212ef5141f
31,807
h
C
clasp/logic_program.h
rkaminsk/clasp
39b7921fd7d218f5a354042b546e57f3bde2345a
[ "MIT" ]
85
2016-10-25T10:44:32.000Z
2022-02-04T23:34:39.000Z
clasp/logic_program.h
rkaminsk/clasp
39b7921fd7d218f5a354042b546e57f3bde2345a
[ "MIT" ]
63
2016-12-17T07:36:12.000Z
2022-03-14T23:08:01.000Z
clasp/logic_program.h
rkaminsk/clasp
39b7921fd7d218f5a354042b546e57f3bde2345a
[ "MIT" ]
16
2016-11-19T13:52:42.000Z
2021-03-15T15:15:35.000Z
// // Copyright (c) 2013-2017 Benjamin Kaufmann // // This file is part of Clasp. See http://www.cs.uni-potsdam.de/clasp/ // // 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. // #ifndef CLASP_LOGIC_PROGRAM_H_INCLUDED #define CLASP_LOGIC_PROGRAM_H_INCLUDED #ifdef _MSC_VER #pragma once #endif #include <clasp/logic_program_types.h> #include <clasp/program_builder.h> #include <clasp/statistics.h> #include POTASSCO_EXT_INCLUDE(unordered_set) namespace Clasp { namespace Asp { /*! * \file * \defgroup asp Asp * \brief Classes and functions for defining logic programs. * \ingroup problem */ //@{ //! A struct for counting program rules and directives. struct RuleStats { typedef uint32& Ref_t; typedef uint32 const& CRef_t; //! Rules and directives counted by this object. enum Key { Normal = Head_t::Disjunctive,//!< Normal or disjunctive rules. Choice = Head_t::Choice, //!< Choice rules. Minimize , //!< Distinct minimize constraints. Acyc , //!< Edge directives. Heuristic , //!< Heuristic directives. Key__num }; //! Returns a string representation of the given key. static const char* toStr(int k); //! Returns the number of keys distinguished by this type. static uint32 numKeys() { return Key__num; } //! Updates the number of rules of the given type. void up(Key k, int amount) { key[k] += static_cast<uint32>(amount); } //! Returns the number of rules of the given type. Ref_t operator[](int k) { return key[k]; } //! @copydoc operator[](int k) CRef_t operator[](int k) const { return key[k]; } //! Returns the sum of all rules. uint32 sum() const; uint32 key[Key__num]; //!< @private }; //! A struct for counting distinct program bodies. struct BodyStats { typedef uint32& Ref_t; typedef uint32 const& CRef_t; //! Body types distinguished by this object. typedef Body_t Key; //! Returns a string representation of the given key. static const char* toStr(int k); //! Returns the number of keys distinguished by this type. static uint32 numKeys() { return Body_t::eMax + 1; } //! Updates the number of bodies of the given type. void up(Key k, int amount) { key[k] += static_cast<uint32>(amount); } //! Returns the number of bodies of the given type. Ref_t operator[](int k) { return key[k]; } //! @copydoc operator[](int k) CRef_t operator[](int k) const { return key[k]; } //! Returns the sum of all bodies. uint32 sum() const; uint32 key[Body_t::eMax + 1]; //!< @private }; //! A type for maintaining a set of program statistics. class LpStats { public: LpStats() { reset(); } void reset(); //! Returns the sum of all equivalences. uint32 eqs() const { return eqs(Var_t::Atom) + eqs(Var_t::Body) + eqs(Var_t::Hybrid); } //! Returns the number of equivalences of the given type. uint32 eqs(VarType t) const { return eqs_[t-1]; } //! Increments the number of equivalences of the given type. void incEqs(VarType t) { ++eqs_[t-1]; } //! Computes *this += o. void accu(const LpStats& o); RuleStats rules[2]; /**< RuleStats (initial, final). */ BodyStats bodies[2]; /**< BodyStats (initial, final). */ uint32 atoms; /**< Number of program atoms. */ uint32 auxAtoms; /**< Number of aux atoms created. */ uint32 disjunctions[2]; /**< Number of disjunctions (initial, non-hcf). */ uint32 sccs; /**< How many strongly connected components? */ uint32 nonHcfs; /**< How many non head-cycle free components?*/ uint32 gammas; /**< How many non-hcf gamma rules. */ uint32 ufsNodes; /**< How many nodes in the positive dependency graph? */ // StatisticObject static uint32 size(); static const char* key(uint32 i); StatisticObject at(const char* k) const; private: uint32 eqs_[3]; }; //! Exception type for signaling an invalid incremental program update. class RedefinitionError : public std::logic_error { public: explicit RedefinitionError(unsigned atomId, const char* atomName = ""); unsigned atom() const { return atomId_; } private: unsigned atomId_; }; using Potassco::TheoryData; struct MapLit_t { POTASSCO_ENUM_CONSTANTS(MapLit_t, Raw = 0, Refined = 1); }; //! A class for defining a logic program. /*! * Use this class to specify a logic program. Once the program is completly defined, * call endProgram() to load the logic program into a SharedContext object. */ class LogicProgram : public ProgramBuilder { public: LogicProgram(); ~LogicProgram(); //! Defines the possible modes for handling extended rules, i.e. choice, cardinality, and weight rules. enum ExtendedRuleMode { mode_native = 0, //!< Handle extended rules natively. mode_transform = 1, //!< Transform extended rules to normal rules. mode_transform_choice = 2, //!< Transform only choice rules to normal rules. mode_transform_card = 3, //!< Transform only cardinality rules to normal rules. mode_transform_weight = 4, //!< Transform cardinality- and weight rules to normal rules. mode_transform_scc = 5, //!< Transform recursive cardinality- and weight rules to normal rules. mode_transform_nhcf = 6, //!< Transform cardinality- and weight rules in non-hcf components to normal rules. mode_transform_integ = 7, //!< Transform cardinality-based integrity constraints. mode_transform_dynamic= 8 //!< Heuristically decide whether or not to transform a particular extended rule. }; //! Options for the Asp-Preprocessor. struct AspOptions { static const uint32 MAX_EQ_ITERS = static_cast<uint32>( (1u<<25)-1 ); typedef ExtendedRuleMode TrMode; AspOptions() { std::memset(this, 0, sizeof(AspOptions)); iters = 5; } AspOptions& iterations(uint32 it) { iters = it;return *this;} AspOptions& depthFirst() { dfOrder = 1; return *this;} AspOptions& backpropagate() { backprop= 1; return *this;} AspOptions& noScc() { noSCC = 1; return *this;} AspOptions& noEq() { iters = 0; return *this;} AspOptions& disableGamma() { noGamma = 1; return *this;} AspOptions& ext(ExtendedRuleMode m) { erMode = m; return *this;} AspOptions& distinctTrue() { distTrue= 1; return *this;} TrMode erMode; //!< How to handle extended rules? uint32 iters : 26;//!< Number of iterations in eq-preprocessing or 0 to disable. uint32 noSCC : 1;//!< Disable scc checking? uint32 suppMod : 1;//!< Disable scc checking and compute supported models. uint32 dfOrder : 1;//!< Visit nodes in eq-preprocessing in depth-first order? uint32 backprop : 1;//!< Enable backpropagation during preprocessing? uint32 oldMap : 1;//!< Use old and larger mapping for disjunctive programs. uint32 noGamma : 1;//!< Disable creation of (shifted) gamma rules for non-hcf disjunctions? uint32 distTrue : 1;//!< Add distinct true var for each step instead of one for all steps. }; /*! * \name Step control functions */ //@{ //! Starts the definition of a logic program. LogicProgram& start(SharedContext& ctx, const AspOptions& opts = AspOptions()) { startProgram(ctx); setOptions(opts); return *this; } //! Sets the mode for handling extended rules (default: mode_native). void setExtendedRuleMode(ExtendedRuleMode m) { opts_.ext(m); } //! Enable distinct true vars for incremental steps. void enableDistinctTrue(); //! Sets preprocessing options. void setOptions(const AspOptions& opts); //! Sets the configuration to be used for checker solvers in disjunctive LP solving. void setNonHcfConfiguration(Configuration* c){ nonHcfs_.config = c; } //! Unfreezes a currently frozen program and starts an incremental step. /*! * If a program is to be defined incrementally, this function must be called * exactly once for each step before any new rules or atoms are added. * \note Program update only works correctly under the following assumptions: * - Atoms introduced in step i are either: * - solely defined in step i OR, * - marked as frozen in step i and solely defined in step i+k OR, * - forced to false by a compute statement in step 0. * * \pre The program is either frozen or at step 0. * \post The program is no longer frozen and calling program mutating functions is valid again. * \throws std::logic_error precondition is violated. * \note The function is an alias for ProgramBuilder::updateProgram(). */ bool update() { return updateProgram(); } //! Finishes the definition of the logic program (or its current increment). /*! * Applies program mutating operations issued in the current step and transforms * the new program into the solver's internal representation. * * \return false if the program is conflicting, true otherwise. * * \post * - If true is returned, the program is considered to be "frozen" and calling * program mutating functions is invalid until the next call to update(). * - If false is returned, the state of the object is undefined and start() * and dispose() are the only remaining valid operations. * . * \note The function is an alias for ProgramBuilder::endProgram(). */ bool end() { return endProgram(); } //! Visits the the simplified program by notifying out on its elements. void accept(Potassco::AbstractProgram& out); //! Disposes (parts of) the internal representation of the logic program. /*! * \param forceFullDispose If set to true, the whole program is disposed. Otherwise, * only the rules (of the current step) are disposed but atoms and any incremental * control data remain. */ void dispose(bool forceFullDispose); //! Clones the program and adds it to the given ctx. /* * \pre The program is currently frozen. */ bool clone(SharedContext& ctx); //@} /*! * \name Program mutating functions * * Functions in this group shall only be called if the program is currently not * frozen. That is, only between the call to start() (resp. update() if in * incremental setting) and end(). A std::logic_error is raised if this precondition is violated. * */ //@{ //! Adds a new atom to the program and returns the new atom's id. Atom_t newAtom(); //! Sets atomId as the last input atom of the current step. /*! * All (new or existing) atoms with a larger id than atomId * are considered to be auxiliary and automatically removed before * a new incremental step is started. * * \pre atomId >= startAtom() * \post startAuxAtom() == atomId + 1 */ void setMaxInputAtom(uint32 atomId); //! Adds a new conjunctive condition to the program. /*! * \param cond A (possibly empty) list of atom literals. * \return The id of the new condition, which can be later passed to * extractCondition() or getLiteral(). */ Id_t newCondition(const Potassco::LitSpan& cond); //! Adds the given string to the problem's output table. /*! * \param str The string to add. * \param cond The condition under which str should be considered part of a model. */ LogicProgram& addOutput(const ConstString& str, const Potassco::LitSpan& cond); LogicProgram& addOutput(const ConstString& str, Id_t cond); //! Adds the given atoms to the set of projection variables. LogicProgram& addProject(const Potassco::AtomSpan& atoms); //! Protects an otherwise undefined atom from preprocessing. /*! * If the atom is defined in this or a previous step, the operation has no effect. * \note If atomId is not yet known, an atom with the given id is implicitly created. * \note The second parameter defines the assumption that shall hold during solving, i.e. * - posLit(atomId), if value is value_true, * - negLit(atomId), if value is value_false, or * - no assumption, if value is value_free. * * \see ProgramBuilder::getAssumptions(LitVec&) const; */ LogicProgram& freeze(Atom_t atomId, ValueRep value = value_false); //! Removes any protection from the given atom. /*! * If the atom is defined in this or a previous step, the operation has no effect. * \note * - The effect is logically equivalent to adding a rule atomId :- false. * - A call to unfreeze() always overwrites a call to freeze() even if the * latter comes after the former * . */ LogicProgram& unfreeze(Atom_t atomId); //! Adds the given rule (or integrity constraint) to the program. /*! * \pre The the rule does not define an atom from a previous incremental step. * * Simplifies the given rule and adds it to the program if it * is neither tautological (e.g. a :- a) nor contradictory (e.g. a :- b, not b). * Atoms in the simplified rule that are not yet known are implicitly created. * * \throws RedefinitionError if the precondition is violated. * \note If the head of the simplified rule mentions an atom from a previous step, * that atom shall either be frozen or false. In the former case, * unfreeze() is implicitly called. In the latter case, the rule is interpreted * as an integrity constraint. */ LogicProgram& addRule(const Rule& rule); LogicProgram& addRule(Head_t ht, const Potassco::AtomSpan& head, const Potassco::LitSpan& body); LogicProgram& addRule(Head_t ht, const Potassco::AtomSpan& head, Potassco::Weight_t bound, const Potassco::WeightLitSpan& lits); LogicProgram& addRule(Potassco::RuleBuilder& rb); //! Adds the given minimize statement. /*! * \param prio The priority of the minimize statement. * \param lits The literals to minimize. * \note All minimize statements of the same priority are merged into one. */ LogicProgram& addMinimize(weight_t prio, const Potassco::WeightLitSpan& lits); //! Adds an edge to the extended (user-defined) dependency graph. LogicProgram& addAcycEdge(uint32 n1, uint32 n2, const Potassco::LitSpan& condition) { return addAcycEdge(n1, n2, newCondition(condition)); } LogicProgram& addAcycEdge(uint32 n1, uint32 n2, Id_t cond); //! Adds a conditional domain heuristic directive to the program. LogicProgram& addDomHeuristic(Atom_t atom, DomModType t, int bias, unsigned prio, const Potassco::LitSpan& condition) { return addDomHeuristic(atom, t, bias, prio, newCondition(condition)); } LogicProgram& addDomHeuristic(Atom_t atom, DomModType t, int bias, unsigned prio, Id_t cond); //! Adds an unconditional domain heuristic directive to the program. LogicProgram& addDomHeuristic(Atom_t atom, DomModType t, int bias, unsigned prio); //! Forces the given literals to be true during solving. /*! * Assumptions are retracted on the next program update. */ LogicProgram& addAssumption(const Potassco::LitSpan& cube); //! Adds or updates the given external atom. /*! * \see LogicProgram::freeze(Atom_t atomId, ValueRep value); * \see LogicProgram::unfreeze(Atom_t atomId); */ LogicProgram& addExternal(Atom_t atomId, Potassco::Value_t value); //! Returns an object for adding theory data to this program. TheoryData& theoryData(); //@} /*! * \name Query functions * * Functions in this group are useful to query important information * once the program is frozen, i.e. after end() was called. * They do not throw exceptions. */ //@{ //! Returns whether the program can be represented in internal smodels format. bool supportsSmodels() const; //! Returns whether the program is to be defined incrementally. bool isIncremental() const { return incData_ != 0; } //! Returns whether the program contains any minimize statements. bool hasMinimize() const { return !minimize_.empty(); } //! Returns whether the program contains any theory data. bool hasTheoryData() const { return theory_ != 0; } //! Returns the number of atoms in the logic program. uint32 numAtoms() const { return (uint32)atoms_.size()-1; } //! Returns the number of bodies in the current (slice of the) logic program. uint32 numBodies() const { return (uint32)bodies_.size(); } //! Returns the number of disjunctive heads. uint32 numDisjunctions() const { return (uint32)disjunctions_.size(); } //! Returns the id of the first atom of the current step. Atom_t startAtom() const { return input_.lo; } //! Returns an id one past the last valid atom id in the program. Atom_t endAtom() const { return numAtoms() + 1; } //! Returns the id of the first atom that is not an input atom or endAtom() if no such atoms exists. Atom_t startAuxAtom() const; //! Returns whether a is an atom in the (simplified) program. bool inProgram(Atom_t a) const; //! Returns whether a is an external atom, i.e. is frozen in this step. bool isExternal(Atom_t a) const; //! Returns whether a occurs in the head of a rule. bool isDefined(Atom_t a) const; //! Returns whether a is a fact. bool isFact(Atom_t a) const; //! Returns the solver literal that is associated with the given atom or condition. /*! * \pre id is the id of a valid atom literal or was previously returned by newCondition(). * \note Until end() is called, the function returns lit_false() for * all atoms and conditions defined in the current step. * \note For an atom literal x with Potassco::atom(x) == a, * getLiteral(Potassco::id(x)) returns * getLiteral(a), iff x == a, or * ~getLiteral(a), iff x == -a. * * \note If mode is MapLit_t::Raw, the function simply returns the literal that * was set during preprocessing. Otherwise, it also considers equivalences * induced by domain heuristic directives and/or step-local true vars. * * \see enableDistinctTrue() */ Literal getLiteral(Id_t id, MapLit_t mode = MapLit_t::Raw) const; //! Returns the atom literals belonging to the given condition. /*! * \pre cId was previously returned by newCondition() in the current step. */ bool extractCondition(Id_t cId, Potassco::LitVec& lits) const; //! Maps the given unsat core of solver literals to original program assumptions. /*! * \param solverCore An unsat core found when solving under ProgramBuilder::getAssumptions(). * \param prgLits The given unsat core expressed in terms of program literals. * \return Whether or not unsatCore was successfully mapped. */ bool extractCore(const LitVec& unsatCore, Potassco::LitVec& prgLits) const; LpStats stats; //!< Statistics of the current step. //@} /*! * \name Implementation functions * Low-level implementation functions. Use with care and only if you * know what you are doing! */ //@{ typedef VarVec::const_iterator VarIter; typedef PrgHead*const* HeadIter; typedef std::pair<EdgeIterator, EdgeIterator> EdgeRange; typedef std::pair<HeadIter, HeadIter> HeadRange; struct SRule { SRule() : hash(0), pos(0), bid(varMax) {} uint32 hash; // hash value of the body uint32 pos; // positive size of body uint32 bid; // id of existing body or varMax }; const AspOptions& options() const { return opts_; } bool hasConflict() const { return getTrueAtom()->literal() != lit_true(); } bool ok() const { return !hasConflict() && ProgramBuilder::ok(); } PrgAtom* getAtom(Id_t atomId)const { return atoms_[atomId]; } PrgHead* getHead(PrgEdge it) const { return it.isAtom() ? (PrgHead*)getAtom(it.node()) : (PrgHead*)getDisj(it.node()); } PrgNode* getSupp(PrgEdge it) const { return it.isBody() ? (PrgNode*)getBody(it.node()) : (PrgNode*)getDisj(it.node()); } Id_t getRootId(Id_t atom)const { return getEqNode(atoms_, atom); } PrgAtom* getRootAtom(Id_t a) const { return getAtom(getRootId(a)); } PrgBody* getBody(Id_t bodyId)const { return bodies_[bodyId]; } Id_t getEqBody(Id_t b) const { return getEqNode(bodies_, b); } PrgDisj* getDisj(Id_t disjId)const { return disjunctions_[disjId]; } HeadIter disj_begin() const { return disjunctions_.empty() ? 0 : reinterpret_cast<HeadIter>(&disjunctions_[0]); } HeadIter disj_end() const { return disj_begin() + numDisjunctions(); } HeadIter atom_begin() const { return reinterpret_cast<HeadIter>(&atoms_[0]); } HeadIter atom_end() const { return atom_begin() + (numAtoms()+1); } VarIter unfreeze_begin() const { return incData_?incData_->unfreeze.begin() : propQ_.end(); } VarIter unfreeze_end() const { return incData_?incData_->unfreeze.end() : propQ_.end(); } bool validAtom(Id_t aId) const { return aId < (uint32)atoms_.size(); } bool validBody(Id_t bId) const { return bId < numBodies(); } bool validDisj(Id_t dId) const { return dId < numDisjunctions(); } bool isFact(PrgAtom* a) const; const char*findName(Atom_t x) const; bool simplifyRule(const Rule& r, Potassco::RuleBuilder& out, SRule& meta); Atom_t falseAtom(); VarVec& getSupportedBodies(bool sorted); uint32 update(PrgBody* b, uint32 oldHash, uint32 newHash); bool assignValue(PrgAtom* a, ValueRep v, PrgEdge reason); bool assignValue(PrgHead* h, ValueRep v, PrgEdge reason); bool propagate(bool backprop); PrgAtom* mergeEqAtoms(PrgAtom* a, Id_t rootAtom); PrgBody* mergeEqBodies(PrgBody* b, Id_t rootBody, bool hashEq, bool atomsAssigned); bool propagate() { return propagate(options().backprop != 0); } void setConflict() { getTrueAtom()->setLiteral(lit_false()); } AtomState& atomState() { return atomState_; } void addMinimize(); // ------------------------------------------------------------------------ // Statistics void incTrAux(uint32 n) { stats.auxAtoms += n; } void incEqs(VarType t) { stats.incEqs(t); } void upStat(RuleStats::Key k, int n = 1){ stats.rules[statsId_].up(k, n); } void upStat(Body_t k, int n = 1) { stats.bodies[statsId_].up(k, n); } void upStat(Head_t k, int n = 1) { stats.rules[statsId_].up(static_cast<RuleStats::Key>(unsigned(k)), n); } // ------------------------------------------------------------------------ //@} private: LogicProgram(const LogicProgram&); LogicProgram& operator=(const LogicProgram&); struct DlpTr; struct AcycArc { Id_t cond; uint32 node[2]; }; struct DomRule { uint32 atom : 29; uint32 type : 3; Id_t cond; int16 bias; uint16 prio; }; struct Eq { Atom_t var; Literal lit; }; struct TFilter { bool operator()(const Potassco::TheoryAtom& atom) const; LogicProgram* self; }; struct Min { weight_t prio; Potassco::WLitVec lits; }; struct CmpMin { bool operator()(const Min* m1, const Min* m2) const { return m1->prio < m2->prio; } }; typedef Potassco::RuleBuilder RuleBuilder; typedef std::pair<Id_t, ConstString> ShowPair; typedef PodVector<ShowPair>::type ShowVec; typedef PodVector<DomRule>::type DomRules; typedef PodVector<AcycArc>::type AcycRules; typedef PodVector<RuleBuilder*>::type RuleList; typedef PodVector<Min*>::type MinList; typedef PodVector<uint8>::type SccMap; typedef PodVector<Eq>::type EqVec; typedef POTASSCO_EXT_NS::unordered_multimap<uint32, uint32> IndexMap; typedef POTASSCO_EXT_NS::unordered_set<Id_t> IdSet; typedef IndexMap::iterator IndexIter; typedef std::pair<IndexIter, IndexIter> IndexRange; typedef Potassco::WLitVec LpWLitVec; typedef Potassco::LitVec LpLitVec; typedef Range<uint32> AtomRange; // ------------------------------------------------------------------------ // virtual overrides bool doStartProgram(); bool doUpdateProgram(); bool doEndProgram(); void doGetAssumptions(LitVec& out) const; ProgramParser* doCreateParser(); int doType() const { return Problem_t::Asp; } // ------------------------------------------------------------------------ // Program definition bool isNew(Atom_t atomId) const { return atomId >= startAtom(); } PrgAtom* resize(Atom_t atomId); void pushFrozen(PrgAtom* atom, ValueRep v); void addRule(const Rule& r, const SRule& meta); void addFact(const Potassco::AtomSpan& head); void addIntegrity(const Rule& b, const SRule& meta); bool handleNatively(const Rule& r) const; bool transformNoAux(const Rule& r) const; void freezeTheory(); void transformExtended(); void transformIntegrity(uint32 nAtoms, uint32 maxAux); PrgBody* getBodyFor(const Rule& r, const SRule& m, bool addDeps = true); PrgBody* getTrueBody(); PrgDisj* getDisjFor(const Potassco::AtomSpan& heads, uint32 headHash); PrgBody* assignBodyFor(const Rule& r, const SRule& m, EdgeType x, bool strongSimp); bool equalLits(const PrgBody& b, const WeightLitSpan& lits) const; bool simplifyNormal(Head_t ht, const Potassco::AtomSpan& head, const Potassco::LitSpan& body, RuleBuilder& out, SRule& info); bool simplifySum(Head_t ht, const Potassco::AtomSpan& head, const Potassco::Sum_t& body, RuleBuilder& out, SRule& info); bool pushHead(Head_t ht, const Potassco::AtomSpan& head, weight_t slack, RuleBuilder& out); ValueRep litVal(const PrgAtom* a, bool pos) const; uint32 findBody(uint32 hash, Body_t type, uint32 size, weight_t bound = -1, Potassco::WeightLit_t* wlits = 0); uint32 findEqBody(const PrgBody* b, uint32 hash); uint32 removeBody(PrgBody* b, uint32 oldHash); Literal getEqAtomLit(Literal lit, const BodyList& supports, Preprocessor& p, const SccMap& x); bool positiveLoopSafe(PrgBody* b, PrgBody* root) const; void prepareExternals(); void updateFrozenAtoms(); void normalize(); template <class C> Id_t getEqNode(C& vec, Id_t id) const { if (!vec[id]->eq()) return id; PrgNode* n = vec[id], *r; Id_t root = n->id(); for (r = vec[root]; r->eq(); r = vec[root]) { // n == r and r == r' -> n == r' assert(root != r->id()); n->setEq(root = r->id()); } return root; } bool checkBody(const PrgBody& rhs, Body_t type, uint32 size, weight_t bound) const { return (rhs.relevant() || (rhs.eq() && getBody(getEqBody(rhs.id()))->relevant())) && rhs.type() == type && rhs.size() == size && rhs.bound() == bound; } // ------------------------------------------------------------------------ // Nogood creation void prepareProgram(bool checkSccs); void prepareOutputTable(); void finalizeDisjunctions(Preprocessor& p, uint32 numSccs); void prepareComponents(); bool addConstraints(); void addAcycConstraint(); void addDomRules(); void freezeAssumptions(); // ------------------------------------------------------------------------ void deleteAtoms(uint32 start); PrgAtom* getTrueAtom() const { return atoms_[0]; } RuleBuilder rule_; // temporary: active rule AtomState atomState_; // which atoms appear in the active rule? IndexMap bodyIndex_; // hash -> body id IndexMap disjIndex_; // hash -> disjunction id IndexMap domEqIndex_; // maps eq atoms modified by dom heuristic to aux vars BodyList bodies_; // all bodies AtomList atoms_; // all atoms DisjList disjunctions_;// all (head) disjunctions MinList minimize_; // list of minimize rules RuleList extended_; // extended rules to be translated ShowVec show_; // shown atoms/conditions VarVec initialSupp_; // bodies that are (initially) supported VarVec propQ_; // assigned atoms VarVec frozen_; // list of frozen atoms LpLitVec assume_; // set of assumptions NonHcfSet nonHcfs_; // set of non-hcf sccs TheoryData* theory_; // optional map of theory data AtomRange input_; // input atoms of current step int statsId_; // which stats to update (0 or 1) struct Aux { AtomList scc; // atoms that are strongly connected DomRules dom; // list of domain heuristic directives AcycRules acyc; // list of user-defined edges for acyclicity check VarVec project; // atoms in projection directives VarVec external; // atoms in external directives IdSet skippedHeads; // heads of rules that have been removed during parsing }* auxData_; // additional state for handling extended constructs struct Incremental { // first: last atom of step, second: true var typedef std::pair<uint32, uint32> StepTrue; typedef PodVector<StepTrue>::type TrueVec; Incremental(); uint32 startScc; // first valid scc number in this iteration VarVec unfreeze; // list of atoms to unfreeze in this step VarVec doms; // list of atom variables with domain modification TrueVec steps; // map of steps to true var }* incData_; // additional state for handling incrementally defined programs AspOptions opts_; // preprocessing }; //! Returns the internal solver literal that is associated with the given atom literal. /*! * \pre The prg is frozen and atomLit is a known atom in prg. */ inline Literal solverLiteral(const LogicProgram& prg, Potassco::Lit_t atomLit) { POTASSCO_REQUIRE(prg.frozen() && prg.validAtom(Potassco::atom(atomLit))); return prg.getLiteral(Potassco::id(atomLit)); } //! Adapts a LogicProgram object to the Potassco::AbstractProgram interface. class LogicProgramAdapter : public Potassco::AbstractProgram { public: LogicProgramAdapter(LogicProgram& prg); void initProgram(bool inc); void beginStep(); void endStep(); void rule(Potassco::Head_t ht, const Potassco::AtomSpan& head, const Potassco::LitSpan& body); void rule(Potassco::Head_t ht, const Potassco::AtomSpan& head, Potassco::Weight_t bound, const Potassco::WeightLitSpan& body); void minimize(Potassco::Weight_t prio, const Potassco::WeightLitSpan& lits); void project(const Potassco::AtomSpan& atoms); void output(const Potassco::StringSpan& str, const Potassco::LitSpan& cond); void external(Potassco::Atom_t a, Potassco::Value_t v); void assume(const Potassco::LitSpan& lits); void heuristic(Potassco::Atom_t a, Potassco::Heuristic_t t, int bias, unsigned prio, const Potassco::LitSpan& cond); void acycEdge(int s, int t, const Potassco::LitSpan& cond); void theoryTerm(Potassco::Id_t termId, int number); void theoryTerm(Potassco::Id_t termId, const Potassco::StringSpan& name); void theoryTerm(Potassco::Id_t termId, int cId, const Potassco::IdSpan& args); void theoryElement(Potassco::Id_t elementId, const Potassco::IdSpan& terms, const Potassco::LitSpan& cond); void theoryAtom(Potassco::Id_t atomOrZero, Potassco::Id_t termId, const Potassco::IdSpan& elements); void theoryAtom(Potassco::Id_t atomOrZero, Potassco::Id_t termId, const Potassco::IdSpan& elements, Potassco::Id_t op, Potassco::Id_t rhs); protected: Asp::LogicProgram* lp_; bool inc_; }; //@} } } // end namespace Asp #endif
46.912979
192
0.686075
[ "object", "model", "transform" ]
556ecd2de4c6774e764111b32522c772df1c5e3b
1,898
h
C
src/names.h
suetanvil/lst3r
2fd76dfc21e45bc7fdb9a09773d77b836f51d9b0
[ "MIT" ]
2
2018-10-18T02:52:05.000Z
2018-12-08T20:32:26.000Z
src/names.h
suetanvil/lst3r
2fd76dfc21e45bc7fdb9a09773d77b836f51d9b0
[ "MIT" ]
null
null
null
src/names.h
suetanvil/lst3r
2fd76dfc21e45bc7fdb9a09773d77b836f51d9b0
[ "MIT" ]
1
2018-10-18T02:52:14.000Z
2018-10-18T02:52:14.000Z
/* Little Smalltalk, version 2 Written by Tim Budd, Oregon State University, July 1987 */ #ifndef __NAMES_H #define __NAMES_H // Sizes (OBSIZE_*) and field offsets (OFST_*) of instances of several // well-known internal classes. enum ClassOffsets { OBSIZE_class = 5, OFST_class_name = 1, OFST_class_size = 2, OFST_class_methods = 3, OFST_class_superClass = 4, OFST_class_variables = 5, OBSIZE_method = 8, OFST_method_text = 1, OFST_method_message = 2, OFST_method_bytecodes = 3, OFST_method_literals = 4, OFST_method_stackSize = 5, OFST_method_temporarySize = 6, OFST_method_methodClass = 7, OFST_method_watch = 8, OBSIZE_context = 6, OFST_context_linkPtr = 1, OFST_context_method = 2, OFST_context_arguments = 3, OFST_context_temporaries = 4, OBSIZE_block = 6, OFST_block_context = 1, OFST_block_argumentCount = 2, OFST_block_argumentLocation = 3, OFST_block_bytecountPosition = 4, OBSIZE_process = 3, OFST_process_stack = 1, OFST_process_stackTop = 2, OFST_process_linkPtr = 3, }; // Index of nilobj; this needs to be a #define so that we can use it // for compile-time initialization. #define NIL_OBJ ((object)0) // Indexes of well known objects extern const object nilobj; extern object trueobj; // the pseudo variable true extern object falseobj; // the pseudo variable false */ // Well-known symbols; these are a (faster) special case in the // interpreter. extern object unSyms[], binSyms[]; extern object globalSymbol(char *str); extern void nameTableInsert(object dict, int hash, object key, object value); extern object hashEachElement(object dict, int hash, int (*fun)(object)); extern int strHash(char *str); extern object globalKey(char *str); extern object nameTableLookup(object dict, char *str); extern void initCommonSymbols(void); #endif
27.507246
77
0.719705
[ "object" ]
556edb3ecb705ddd4e24b56280997afc499079e5
10,230
h
C
Development/Eurorack Set 2021/Wobbler2Drum.h
ThisIsNotRocketScience/Eurorack-Modules
b9ae6977f81965aae9147b1e1fd647531eebf216
[ "MIT" ]
58
2015-11-19T16:52:43.000Z
2021-12-10T22:02:07.000Z
Development/Eurorack Set 2021/Wobbler2Drum.h
ThisIsNotRocketScience/Eurorack-Modules
b9ae6977f81965aae9147b1e1fd647531eebf216
[ "MIT" ]
null
null
null
Development/Eurorack Set 2021/Wobbler2Drum.h
ThisIsNotRocketScience/Eurorack-Modules
b9ae6977f81965aae9147b1e1fd647531eebf216
[ "MIT" ]
20
2016-01-02T01:19:10.000Z
2022-03-14T16:23:47.000Z
#pragma once #include <stdint.h> #include <stdio.h> #include <math.h> #include "EurorackShared/EurorackShared.h" #include "Wobbler2Code/Wobbler2.h" extern const uint32_t Cmapping[]; typedef struct { int32_t lo; int32_t mid; int32_t hi; } intsvg_t; const unsigned short tblDecayTime[] = { 0x0002, 0x0003, 0x0003, 0x0004, 0x0005, 0x0005, 0x0006, 0x0007, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0018, 0x0019, 0x001B, 0x001C, 0x001E, 0x001F, 0x0021, 0x0023, 0x0024, 0x0026, 0x0028, 0x002A, 0x002C, 0x002E, 0x0031, 0x0033, 0x0035, 0x0038, 0x003A, 0x003D, 0x003F, 0x0042, 0x0045, 0x0048, 0x004B, 0x004E, 0x0051, 0x0055, 0x0058, 0x005C, 0x005F, 0x0063, 0x0067, 0x006B, 0x006F, 0x0073, 0x0078, 0x007C, 0x0081, 0x0085, 0x008A, 0x008F, 0x0095, 0x009A, 0x009F, 0x00A5, 0x00AB, 0x00B1, 0x00B7, 0x00BD, 0x00C4, 0x00CA, 0x00D1, 0x00D8, 0x00DF, 0x00E7, 0x00EE, 0x00F6, 0x00FE, 0x0106, 0x010F, 0x0118, 0x0121, 0x012A, 0x0133, 0x013D, 0x0147, 0x0151, 0x015B, 0x0166, 0x0171, 0x017C, 0x0187, 0x0193, 0x019F, 0x01AC, 0x01B8, 0x01C5, 0x01D3, 0x01E0, 0x01EE, 0x01FD, 0x020B, 0x021A, 0x022A, 0x0239, 0x024A, 0x025A, 0x026B, 0x027C, 0x028E, 0x02A0, 0x02B3, 0x02C6, 0x02D9, 0x02ED, 0x0302, 0x0317, 0x032C, 0x0342, 0x0358, 0x036F, 0x0387, 0x039E }; const unsigned long tblNoteTable[] = { 0x000C265D, 0x000CDF51, 0x000DA344, 0x000E72DE, 0x000F4ED0, 0x001037D7, 0x00112EB8, 0x00123448, 0x00134965, 0x00146EFD, 0x0015A60A, 0x0016EF96, 0x00184CBB, 0x0019BEA2, 0x001B4689, 0x001CE5BD, 0x001E9DA1, 0x00206FAE, 0x00225D71, 0x00246891, 0x002692CB, 0x0028DDFB, 0x002B4C15, 0x002DDF2D, 0x00309976, 0x00337D45, 0x00368D12, 0x0039CB7A, 0x003D3B43, 0x0040DF5C, 0x0044BAE3, 0x0048D122, 0x004D2597, 0x0051BBF7, 0x0056982B, 0x005BBE5B, 0x006132ED, 0x0066FA8B, 0x006D1A24, 0x007396F4, 0x007A7686, 0x0081BEB9, 0x008975C6, 0x0091A244, 0x009A4B2F, 0x00A377EE, 0x00AD3056, 0x00B77CB6, 0x00C265DB, 0x00CDF516, 0x00DA3449, 0x00E72DE9, 0x00F4ED0D, 0x01037D73, 0x0112EB8C, 0x01234489, 0x0134965F, 0x0146EFDC, 0x015A60AD, 0x016EF96D, 0x0184CBB6, 0x019BEA2D, 0x01B46892, 0x01CE5BD2, 0x01E9DA1A, 0x0206FAE6, 0x0225D719, 0x02468912, 0x02692CBF, 0x028DDFB9, 0x02B4C15A, 0x02DDF2DB, 0x0309976D, 0x0337D45B, 0x0368D125, 0x039CB7A5, 0x03D3B434, 0x040DF5CC, 0x044BAE33, 0x048D1225, 0x04D2597F, 0x051BBF72, 0x056982B5, 0x05BBE5B7, 0x06132EDB, 0x066FA8B6, 0x06D1A24A, 0x07396F4B, 0x07A76868, 0x081BEB99, 0x08975C67, 0x091A244A, 0x09A4B2FE, 0x0A377EE5, 0x0AD3056A, 0x0B77CB6E, 0x0C265DB7, 0x0CDF516D, 0x0DA34494, 0x0E72DE96, 0x0F4ED0D1, 0x1037D732, 0x112EB8CE, 0x12344894, 0x134965FD, 0x146EFDCB, 0x15A60AD5, 0x16EF96DC, 0x184CBB6F, 0x19BEA2DB, 0x1B468928, 0x1CE5BD2C, 0x1E9DA1A3, 0x206FAE64, 0x225D719D, 0x24689129, 0x2692CBFA, 0x28DDFB96, 0x2B4C15AA, 0x2DDF2DB9, 0x309976DF, 0x337D45B6, 0x368D1251, 0x39CB7A58, 0x3D3B4347, 0x40DF5CC9, 0x44BAE33A, 0x48D12252 }; enum { RATTLEENV_STOP, RATTLEENV_HOLD, RATTLEENV_DECAY, RATTLEENV_LASTDECAY, RATTLEENV_REST, RATTLEENV_ATTACK, }; enum { DECAYENV_STOP, DECAYENV_HOLD, DECAYENV_DECAY, DECAYENV_ATTACK, }; class Filter { #define HI16(x) (x>>16) #define LO16(x) (x&65535) public: intsvg_t filt; int32_t GetLP(int32_t input) { Pump(input); return filt.lo; } int32_t GetBP(int32_t input) { Pump(input); return filt.mid; } int32_t GetHP(int32_t input) { Pump(input); return filt.hi; } void SetCut(int val) // val is midi range! 0-127 { unsigned long nC = Cmapping[val]; if (nC > C) { dC = (nC - C) / 80; finertiacount = 80; } else { dC = (C - nC) / 80; dC = -dC; finertiacount = 80; } } void SetRes(int val) // val is midi range! 0-127 { R = (unsigned short)((val << 8) + (64 << 9)); unsigned short Max = (0xf200 - sC); unsigned long fR = R * Max; sR = ~HI16(fR); } unsigned long C; signed long dC; unsigned short sC; unsigned short R; unsigned short sR; unsigned long finertiacount; void Pump(int32_t input) { if (finertiacount) { C += dC; finertiacount--; } sC = HI16(C); signed short const tMid = HI16(filt.mid); filt.hi = (input) - filt.lo - sR * tMid; filt.mid += sC * HI16(filt.hi); filt.lo += sC * tMid; } }; class DecayEnv { public: int EnvTime; int EnvState; int EnvCurrent; int EnvDelta; int DecayTime; int HoldTime; DecayEnv() { EnvCurrent = 0; EnvDelta = 0; EnvTime = 0; HoldTime = 50; DecayTime = 500; EnvState = DECAYENV_STOP; } void Trigger() { EnvState = DECAYENV_ATTACK; EnvTime = 5; EnvDelta = ((1 << 24) - EnvCurrent) / EnvTime; } unsigned short pShape; unsigned short pDecay; void SetParam(unsigned short shape, unsigned short decay) { pShape = shape; pDecay = decay; int idx = decay >> 9; int v = decay & 0x1ff; int iv = 0x1ff - v; DecayTime = (tblDecayTime[idx] * v + tblDecayTime[idx + 1] * iv) <<1; } int32_t Get() { if (EnvState == DECAYENV_STOP) return 0; EnvCurrent += EnvDelta; EnvTime--; if (EnvTime == 0) { switch (EnvState) { case DECAYENV_ATTACK: EnvState = DECAYENV_HOLD; EnvDelta = 0; EnvCurrent = 1 << 24; EnvTime = HoldTime; break; case DECAYENV_HOLD: EnvState = DECAYENV_DECAY; EnvTime = DecayTime; EnvDelta = -1 * ((1 << 24) / EnvTime); break; case DECAYENV_DECAY: EnvState = DECAYENV_STOP; EnvDelta = 0; EnvCurrent = 0; break; default: EnvState = DECAYENV_STOP; break; } } uint32_t SqrEnv = EnvCurrent >> 12; SqrEnv *= EnvCurrent >> 12; return SqrEnv; } }; class RattleEnv { public: int RattleCount; int EnvTime; int EnvState; int RattleLeft; int EnvCurrent ; int EnvDelta; int DecayTime; int HoldTime; int RestTime; int LastDecayMultiplier; RattleEnv() { EnvCurrent = 0; EnvDelta = 0; RattleCount = 5; RattleLeft = 0; EnvTime = 0; HoldTime =20; DecayTime = 300; RestTime = 200; LastDecayMultiplier = 8; EnvState = RATTLEENV_STOP; } void Trigger() { EnvState = RATTLEENV_ATTACK; EnvTime = 5; EnvDelta = ((1 << 24) - EnvCurrent) / EnvTime; RattleLeft = RattleCount; } void SetParam(unsigned short spacing, unsigned short decay) { int idx = decay >> 9; int v = decay & 0x1ff; int iv = 0x1ff - v; DecayTime = (tblDecayTime[idx] * v + tblDecayTime[idx + 1] * iv) >> 6; idx = spacing >> 9; v = spacing & 0x1ff; iv = 0x1ff - v; RestTime = (tblDecayTime[idx] * v + tblDecayTime[idx + 1] * iv) >> 6; } int32_t Get() { if (EnvState == RATTLEENV_STOP) return 0; EnvCurrent += EnvDelta; EnvTime--; if (EnvTime == 0) { switch (EnvState) { case RATTLEENV_ATTACK: EnvState = RATTLEENV_HOLD; EnvDelta = 0; EnvCurrent = 1 << 24; EnvTime = HoldTime; break; case RATTLEENV_HOLD: EnvState = RATTLEENV_DECAY; if (--RattleLeft == 0) { EnvTime = DecayTime * LastDecayMultiplier; } else { EnvTime = DecayTime; } EnvDelta = -1 * ( (1 << 24) / EnvTime); break; case RATTLEENV_DECAY: EnvState = RATTLEENV_REST; EnvDelta = 0; EnvCurrent = 0; EnvTime = RestTime; break; case RATTLEENV_REST: if (RattleLeft > 0) { EnvState = RATTLEENV_ATTACK; EnvTime = 5; EnvDelta = ((1 << 24) - EnvCurrent) / EnvTime; } else { EnvState = RATTLEENV_STOP; EnvDelta = 0; EnvCurrent = 0; } break; default: EnvState = RATTLEENV_STOP; break; } } return EnvCurrent; } }; class Wobbler2Drum { public: Filter Filt; int Phase; int Shape; int Freq; int Mod; int M1; int M2; #define TABBITS 11 #define TABSHIFT (32-TABBITS) #define WOBTABLEN (1 << TABBITS) #define WOBTABMASK (WOBTABLEN-1) int32_t sintab[WOBTABLEN]; RattleEnv ClapRattle; DecayEnv SnareNoiseAmp; DecayEnv BdDecay; DecayEnv PDecay; Wobbler2Drum() { Filt.SetCut(24); Filt.SetRes(50); AmpEnv = 0; DAmpEnv = 0; for (int i = 0; i < WOBTABLEN; i++) { sintab[i] = (int)(sinf((i * 6.283f) /(float)WOBTABLEN) * 32767.0f); } SnareNoiseAmp.SetParam(70, 4); BdDecay.SetParam(70, 74); PDecay.SetParam(70, 40); } int32_t AmpEnv; uint32_t DAmpEnv; uint32_t OscPhase2; uint32_t OscPhase3; uint32_t OscPhase4; uint32_t OscPhase; int32_t DPhase; void Trigger(bool ON = true) { if (ON) { OscPhase = 0; AmpEnv = 0x7fffffff; DAmpEnv = 0x03111; int64_t F = (int64_t)0xffffffff / 440; DPhase = F ; Mod = 0x1fffff; ClapRattle.Trigger(); SnareNoiseAmp.Trigger(); BdDecay.Trigger(); PDecay.Trigger(); } } void Get(int32_t &L, int32_t &R) { AmpEnv -= DAmpEnv; if (AmpEnv < 0) { DAmpEnv = 0; AmpEnv = 0; } DPhase = tblNoteTable[Freq >> 9]; int32_t DR[7] = { 0 }; OscPhase += DPhase + (((PDecay.Get()>>9) * Mod) >> 8); OscPhase2 += (DPhase * 16) / 10; OscPhase3 += (DPhase * 227) / 50; OscPhase4 += (DPhase * 454) / 50; // x2.27 x4.54 // f1 = 500 Hz, f2 = 220 Hz, f3 = 1000Hz. int ClapEnv = ClapRattle.Get()>>8; int noise = (rand() % 65536)-32767; int snareenv = SnareNoiseAmp.Get(); int tombdenv = BdDecay.Get(); int idx = OscPhase >> TABSHIFT; int idx2 = OscPhase2 >> TABSHIFT; int idx3 = OscPhase3 >> TABSHIFT; int idx4 = OscPhase4 >> TABSHIFT; int idxdbl = (OscPhase >> (TABSHIFT - 1)) & WOBTABMASK; DR[0] = (sintab[idx] * (tombdenv >> 10)) >> 16; DR[1] = (sintab[idxdbl] * (tombdenv >> 10)) >> 16;; DR[2] = (((sintab[idx4] + sintab[idx3] + sintab[idxdbl]) * (tombdenv >> 10)) >> 16); int ClapSqrEnv = ClapEnv >> 13; ClapSqrEnv *= ClapEnv >> 12; DR[3] =( (((tombdenv >> 8) * sintab[idx3] + ((0xffffff - tombdenv) >> 8) * sintab[idxdbl])>>16) *(ClapSqrEnv)) >> 8; // ploink DR[4] = (((sintab[idx2] + sintab[idx]) * (tombdenv>>10))>>16 ) +((noise * (snareenv>>10)) >> 16);; // snare DR[5] = ((noise * (snareenv >> 10)) >> 16);;; // hat DR[6] = (noise * (ClapEnv>>8))>>8; // clap SteppedResult_t ShapeStepped; Wobbler2_GetSteppedResult(Shape, 6, &ShapeStepped); // interpolate between al the shapes uint32_t O1 = WobGetInterpolatedResultInt(DR, &ShapeStepped);// / (0xffff * 4); L = O1; R = O1; // L = ( O1*65535) ; // R = ( O1 * 65535) / 65536; } };
22.582781
192
0.657478
[ "shape" ]
5571e739ee26e230efb4c805d63cf34e7da9196b
1,676
h
C
modules/core/misc/objc/common/RotatedRect.h
modeste2015/opencv
c62e63909a90c8faf2179fd39d4a90071bbd32a4
[ "BSD-3-Clause" ]
2
2020-06-12T10:29:23.000Z
2020-06-12T10:29:30.000Z
modules/core/misc/objc/common/RotatedRect.h
jasmineHere/opencv
25f3a11a161bfb2a753cc605e1856ae074627b41
[ "BSD-3-Clause" ]
null
null
null
modules/core/misc/objc/common/RotatedRect.h
jasmineHere/opencv
25f3a11a161bfb2a753cc605e1856ae074627b41
[ "BSD-3-Clause" ]
1
2021-04-11T01:00:21.000Z
2021-04-11T01:00:21.000Z
// // RotatedRect.h // // Created by Giles Payne on 2019/12/26. // #pragma once #ifdef __cplusplus #import "opencv.hpp" #endif @class Point2f; @class Size2f; @class Rect2f; #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /** * Represents a rotated rectangle on a plane */ @interface RotatedRect : NSObject #pragma mark - Properties @property Point2f* center; @property Size2f* size; @property double angle; #ifdef __cplusplus @property(readonly) cv::RotatedRect& nativeRef; #endif #pragma mark - Constructors - (instancetype)init; - (instancetype)initWithCenter:(Point2f*)center size:(Size2f*)size angle:(double)angle; - (instancetype)initWithVals:(NSArray<NSNumber*>*)vals; #ifdef __cplusplus + (instancetype)fromNative:(cv::RotatedRect&)rotatedRect; #endif #pragma mark - Methods /** * Returns the corner points of the rotated rectangle as an array */ - (NSArray<Point2f*>*)points; /** * Returns the bounding (non-rotated) rectangle of the rotated rectangle */ - (Rect2f*)boundingRect; /** * Set the rotated rectangle coordinates, dimensions and angle of rotation from the values of an array * @param vals The array of values from which to set the rotated rectangle coordinates, dimensions and angle of rotation */ - (void)set:(NSArray<NSNumber*>*)vals NS_SWIFT_NAME(set(vals:)); #pragma mark - Common Methods /** * Clone object */ - (RotatedRect*)clone; /** * Compare for equality * @param other Object to compare */ - (BOOL)isEqual:(nullable id)object; /** * Calculate hash value for this object */ - (NSUInteger)hash; /** * Returns a string that describes the contents of the object */ - (NSString*)description; @end NS_ASSUME_NONNULL_END
19.264368
119
0.73747
[ "object" ]
5576b28243c474528c4241863e30a67e242b92bb
1,071
h
C
recentFiles.h
CherryPill/tex_edit
6a0287f892068a44e60bd67d60a4b4272bbc3c60
[ "MIT" ]
null
null
null
recentFiles.h
CherryPill/tex_edit
6a0287f892068a44e60bd67d60a4b4272bbc3c60
[ "MIT" ]
null
null
null
recentFiles.h
CherryPill/tex_edit
6a0287f892068a44e60bd67d60a4b4272bbc3c60
[ "MIT" ]
null
null
null
#include <Windows.h> #include <vector> #ifndef RECENTFILES_H #define RECENTFILES_H //functions affecting the main structure void recentDocsList_clear(void); void recentDocsList_push(LPCTSTR, WPARAM); //gets invoked when uses chooses to open/create/close file //backend void recentDocsList_clear_backend(void); void recentDocsList_push_backend(LPCTSTR); //front-end functions affecting the main menu appearance void recentDocsList_clear_gui(void); void recentDocsList_fill_gui(void); //gets invoked only at startup void recentDocsList_push_gui(LPCTSTR); void recentDocsList_insert_gui(LPCTSTR); void recentDocsList_delete_gui(void); void recentDocsList_delete_backend(void); void recentDocsList_delete(LPCTSTR); bool askForDeletion(void); //dummy void recentDocsList_pop(void); //sys void disableRecentMenuItem(void); void enableRecentMenuItem(void); //fileio bool chkIfRecentFilesExists(void); void loadRecentFiles(void); void writeRecentFiles(void); void setDefaultRecentFiles(void); bool initClearRecProc(void); extern std::vector<std::string> recentDocsList; #endif
30.6
101
0.830999
[ "vector" ]
557bc892d60426b0a63982304bed7eabdfa6effd
315
h
C
SystemResource/Source/Model/FBX/FBX.h
BitPaw/BitFireEngine
2c02a4eae19276bf60ac925e4393966cec605112
[ "MIT" ]
5
2021-10-19T18:30:43.000Z
2022-03-19T22:02:02.000Z
SystemResource/Source/Model/FBX/FBX.h
BitPaw/BitFireEngine
2c02a4eae19276bf60ac925e4393966cec605112
[ "MIT" ]
12
2022-03-09T13:40:21.000Z
2022-03-31T12:47:48.000Z
SystemResource/Source/Model/FBX/FBX.h
BitPaw/BitFireEngine
2c02a4eae19276bf60ac925e4393966cec605112
[ "MIT" ]
null
null
null
#pragma once #include "../IModelFormat.hpp" namespace BF { // FilmBox struct FBX : public IModelFormat { public: FileActionResult Load(const wchar_t* filePath); FileActionResult Save(const wchar_t* filePath); FileActionResult ConvertTo(Model& model); FileActionResult ConvertFrom(Model& model); }; }
19.6875
49
0.746032
[ "model" ]
5587145ac462de75b3a8b4322d6014fc445db06e
4,310
h
C
include/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.h
lukhnos/objclucene
29c7189a0b30ab3d3dd4c8ed148235ee296128b7
[ "MIT" ]
9
2016-01-13T05:38:05.000Z
2020-06-04T23:05:03.000Z
include/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.h
lukhnos/objclucene
29c7189a0b30ab3d3dd4c8ed148235ee296128b7
[ "MIT" ]
4
2016-05-12T10:40:53.000Z
2016-06-11T19:08:33.000Z
include/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.h
lukhnos/objclucene
29c7189a0b30ab3d3dd4c8ed148235ee296128b7
[ "MIT" ]
5
2016-01-13T05:37:39.000Z
2019-07-27T16:53:10.000Z
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: ./queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline") #ifdef RESTRICT_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline #define INCLUDE_ALL_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline 0 #else #define INCLUDE_ALL_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline 1 #endif #undef RESTRICT_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline #if __has_feature(nullability) #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wnullability" #pragma GCC diagnostic ignored "-Wnullability-completeness" #endif #if !defined (OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline_) && (INCLUDE_ALL_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline || defined(INCLUDE_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline)) #define OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline_ #define RESTRICT_OrgApacheLuceneQueryparserFlexibleCoreProcessorsQueryNodeProcessorPipeline 1 #define INCLUDE_OrgApacheLuceneQueryparserFlexibleCoreProcessorsQueryNodeProcessorPipeline 1 #include "org/apache/lucene/queryparser/flexible/core/processors/QueryNodeProcessorPipeline.h" @class OrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler; /*! @brief This pipeline has all the processors needed to process a query node tree, generated by <code>StandardSyntaxParser</code>, already assembled. <br> <br> The order they are assembled affects the results. <br> <br> This processor pipeline was designed to work with <code>StandardQueryConfigHandler</code>. <br> <br> The result query node tree can be used to build a <code>Query</code> object using <code>StandardQueryTreeBuilder</code>. - seealso: StandardQueryTreeBuilder - seealso: StandardQueryConfigHandler - seealso: StandardSyntaxParser */ @interface OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline : OrgApacheLuceneQueryparserFlexibleCoreProcessorsQueryNodeProcessorPipeline #pragma mark Public - (instancetype __nonnull)initWithOrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler:(OrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler *)queryConfig; #pragma mark Package-Private // Disallowed inherited constructors, do not use. - (instancetype __nonnull)init NS_UNAVAILABLE; @end J2OBJC_EMPTY_STATIC_INIT(OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline) FOUNDATION_EXPORT void OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline_initWithOrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler_(OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline *self, OrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler *queryConfig); FOUNDATION_EXPORT OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline *new_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline_initWithOrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler_(OrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler *queryConfig) NS_RETURNS_RETAINED; FOUNDATION_EXPORT OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline *create_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline_initWithOrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler_(OrgApacheLuceneQueryparserFlexibleCoreConfigQueryConfigHandler *queryConfig); J2OBJC_TYPE_LITERAL_HEADER(OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline) #endif #if __has_feature(nullability) #pragma clang diagnostic pop #endif #pragma pop_macro("INCLUDE_ALL_OrgApacheLuceneQueryparserFlexibleStandardProcessorsStandardQueryNodeProcessorPipeline")
55.25641
366
0.902784
[ "object" ]
558eec31e5ce75f004298bd96d82c92e125e4367
3,280
h
C
BIP/Pods/Headers/Public/YTVimeoExtractor/YTVimeoExtractor.h
ttseng/Build-in-Progress-iOS
669e2a23f239a0ed9eb443c2bc1464b4dbb42585
[ "BSD-3-Clause" ]
null
null
null
BIP/Pods/Headers/Public/YTVimeoExtractor/YTVimeoExtractor.h
ttseng/Build-in-Progress-iOS
669e2a23f239a0ed9eb443c2bc1464b4dbb42585
[ "BSD-3-Clause" ]
null
null
null
BIP/Pods/Headers/Public/YTVimeoExtractor/YTVimeoExtractor.h
ttseng/Build-in-Progress-iOS
669e2a23f239a0ed9eb443c2bc1464b4dbb42585
[ "BSD-3-Clause" ]
null
null
null
// // YTVimeoExtractor.h // YTVimeoExtractor // // Created by Louis Larpin on 18/02/13. // #import <Foundation/Foundation.h> #import "YTVimeoError.h" #import "YTVimeoExtractorOperation.h" #import "YTVimeoError.h" #import "YTVimeoURLParser.h" #import "YTVimeoVideo.h" /** * The `YTVimeoExtractor` is the main class and its sole purpose is to fetch information about Vimeo videos. Use the two main methods `<-fetchVideoWithIdentifier:withReferer:completionHandler:>` or `<-fetchVideoWithVimeoURL:withReferer:completionHandler:>` to obtain video information. */ @interface YTVimeoExtractor : NSObject NS_ASSUME_NONNULL_BEGIN /** * ------------------ * @name Initializing * ------------------ */ /** * Returns the shared extractor. * * @return The shared extractor. */ +(instancetype)sharedExtractor; /** * -------------------------------- * @name Fetching Video Information * -------------------------------- */ /** * Starts an asynchronous operation for the specified video identifier, and referer, then calls a handler upon completion. * * @param videoIdentifier A Vimeo video identifier. If the video identifier is `nil` then an exception will be thrown. Also, if it is an empty string the completion handler will be called with the `YTVimeoVideoErrorDomain` domain and `YTVimeoErrorInvalidVideoIdentifier` code. * @param referer The referer, if the Vimeo video has domain-level restrictions. If this value is `nil` then a default one will be used. * @param completionHandler A block to execute when the extraction process is finished, which is executed on the main thread. If the completion handler is nil, this method throws an exception. The block has, two parameters a `YTVimeoVideo` object if, the operation was completed successfully and a `NSError` object describing the network or parsing error that may have occurred. */ -(void)fetchVideoWithIdentifier:(NSString *_Nonnull)videoIdentifier withReferer:(NSString *__nullable)referer completionHandler:(void (^_Nonnull)(YTVimeoVideo * __nullable video, NSError * __nullable error))completionHandler; /** * Starts an asynchronous operation for the specified video URL, and referer, then calls a handler upon completion. * * @param videoURL A Vimeo video URL. If the video URL is `nil` then an exception will be thrown. Also, if it is an empty string the completion handler will be called with the `YTVimeoVideoErrorDomain` domain and `YTVimeoErrorInvalidVideoIdentifier` code. * @param referer The referer, if the Vimeo video has domain-level restrictions. If this value is `nil` then a default one will be used. * @param completionHandler A block to execute when the extraction process is finished, which is executed on the main thread. If the completion handler is nil, this method throws an exception. The block has, two parameters a `YTVimeoVideo` object if, the operation was completed successfully and a `NSError` object describing the network or parsing error that may have occurred. */ -(void)fetchVideoWithVimeoURL:(NSString *_Nonnull)videoURL withReferer:(NSString *__nullable)referer completionHandler:(void (^_Nonnull)(YTVimeoVideo * __nullable video, NSError * __nullable error))completionHandler; @end NS_ASSUME_NONNULL_END
55.59322
379
0.746037
[ "object" ]
559aaccefe238a42d3c44ca3a45c40698a3c9927
1,183
h
C
SarvLibrary/Utilities/idba_src/graph/hash_graph_branch_group.h
cwright7101/llvm_sarvavid
7567d617a7be78fecfde71ab04ebd8e9506a64e4
[ "MIT" ]
null
null
null
SarvLibrary/Utilities/idba_src/graph/hash_graph_branch_group.h
cwright7101/llvm_sarvavid
7567d617a7be78fecfde71ab04ebd8e9506a64e4
[ "MIT" ]
null
null
null
SarvLibrary/Utilities/idba_src/graph/hash_graph_branch_group.h
cwright7101/llvm_sarvavid
7567d617a7be78fecfde71ab04ebd8e9506a64e4
[ "MIT" ]
null
null
null
/** * @file hash_graph_branch_group.h * @brief HashGraphBranchGroup Class. * @author Yu Peng (ypeng@cs.hku.hk) * @version 1.0.4 * @date 2011-09-21 */ #ifndef __GRAPH_HASH_GRAPH_BRANCH_GROUP_H_ #define __GRAPH_HASH_GRAPH_BRANCH_GROUP_H_ #include "../basic/kmer.h" #include "../graph/hash_graph.h" #include "../graph/hash_graph_path.h" #include <vector> /** * @brief It is used to contain a branch group in de Bruijn graph (HashGraph). */ class HashGraphBranchGroup { public: HashGraphBranchGroup(HashGraph *graph, HashGraphVertexAdaptor begin, int max_branches = 2, int max_length = 0) { hash_graph_ = graph; begin_ = begin; max_branches_ = max_branches; max_length_ = max_length; if (max_length_ == 0) max_length_ = begin_.kmer().size() + 2; } bool Search(); void Merge(); HashGraphVertexAdaptor begin() { return begin_; } HashGraphVertexAdaptor end() { return end_; } private: HashGraph *hash_graph_; HashGraphVertexAdaptor begin_; HashGraphVertexAdaptor end_; std::vector<HashGraphPath> branches_; int max_branches_; int max_length_; }; #endif
21.509091
78
0.674556
[ "vector" ]
55c80fe32c0ca2748c498265f1ba0268f8f9cbdc
3,832
h
C
test/argument_parser.h
JennyGH/ezlog
274f7bf1719e1cb751038e2423abcb086cf916c7
[ "MIT" ]
2
2021-03-16T14:16:46.000Z
2022-01-04T08:43:07.000Z
test/argument_parser.h
JennyGH/ezlog
274f7bf1719e1cb751038e2423abcb086cf916c7
[ "MIT" ]
1
2022-01-18T07:02:19.000Z
2022-01-18T07:02:19.000Z
test/argument_parser.h
JennyGH/ezlog
274f7bf1719e1cb751038e2423abcb086cf916c7
[ "MIT" ]
null
null
null
#pragma once #include <map> #include <vector> #include <string> #include <sstream> #include <iostream> #include <stdexcept> typedef std::map<std::string, std::string> _argument_map; class argument_not_found_exception { public: argument_not_found_exception( const std::string& moduleName, const std::string& optionName); ~argument_not_found_exception(); const char* get_module_name() const; const char* what() const; private: std::string m_module_name; std::string m_message; }; static void _is_argument_exist( const std::string& arg_name, const std::string& module_name, _argument_map& arguments) { if (arguments.find(arg_name) == arguments.end()) { throw argument_not_found_exception(module_name, arg_name); } } template <typename value_type> struct _argument_getter { static value_type value_of( const std::string& arg_name, const std::string& module_name, _argument_map& arguments) { _is_argument_exist(arg_name, module_name, arguments); std::stringstream ss; value_type val = value_type(); ss << arguments[arg_name]; ss >> val; return val; } static value_type value_of( const std::string& arg_name, const std::string& module_name, _argument_map& arguments, value_type default_value) { value_type val = default_value; if (arguments.find(arg_name) != arguments.end()) { std::stringstream ss; ss << arguments[arg_name]; ss >> val; } return val; } }; template <> struct _argument_getter<bool> { static bool value_of( const std::string& agr_name, const std::string& module_name, _argument_map& arguments) { _is_argument_exist(agr_name, module_name, arguments); bool val = false; if (arguments.find(agr_name) != arguments.end()) { val = arguments[agr_name] == "true"; } return val; } static bool value_of( const std::string& arg_name, const std::string& module_name, _argument_map& arguments, bool default_value) { bool val = default_value; if (arguments.find(arg_name) != arguments.end()) { val = arguments[arg_name] == "true"; } return val; } }; template <> struct _argument_getter<std::string> { static std::string value_of( const std::string& arg_name, const std::string& module_name, _argument_map& arguments) { _is_argument_exist(arg_name, module_name, arguments); return arguments[arg_name]; } static std::string value_of( const std::string& arg_name, const std::string& module_name, _argument_map& arguments, std::string default_value) { std::string val = default_value; if (arguments.find(arg_name) == arguments.end()) { return val; } return arguments[arg_name]; } }; class argument_parser { public: argument_parser(int argc, char** argv); ~argument_parser(); template <typename T> T get(const std::string& arg_name) { return _argument_getter<T>::value_of( arg_name, m_module_name, m_arguments); } template <typename T> T get(const std::string& argumentName, T default_value) { return _argument_getter<T>::value_of( argumentName, m_module_name, m_arguments, default_value); } std::string get_module_name() const; private: std::string m_module_name; _argument_map m_arguments; };
24.407643
66
0.597077
[ "vector" ]
55cf97563842f1f5e85f93d92e2528caf8dc2488
680
h
C
src/Nodes/Default_Nodes/Modifiers/mapper.h
PlaymodesStudio/ofxOceanode
400df6d49c4b29bc6916e4a045145e935beff4e0
[ "MIT" ]
31
2018-04-20T13:47:38.000Z
2021-12-26T04:32:24.000Z
src/Nodes/Default_Nodes/Modifiers/mapper.h
PlaymodesStudio/ofxOceanode
400df6d49c4b29bc6916e4a045145e935beff4e0
[ "MIT" ]
25
2018-02-19T17:15:32.000Z
2020-01-05T01:51:00.000Z
src/Nodes/Default_Nodes/Modifiers/mapper.h
PlaymodesStudio/ofxOceanode
400df6d49c4b29bc6916e4a045145e935beff4e0
[ "MIT" ]
5
2018-09-25T18:37:23.000Z
2021-01-21T16:26:16.000Z
// // phasorClass.h // DGTL_Generator // // Created by Eduard Frigola on 28/07/16. // // #ifndef mapper_h #define mapper_h #pragma once #include "ofxOceanodeNodeModel.h" class mapper : public ofxOceanodeNodeModel{ public: mapper() : ofxOceanodeNodeModel("Mapper"){}; ~mapper(){}; void setup() override; void recalculate(); private: ofEventListeners listeners; ofParameter<vector<float>> input; ofParameter<vector<float>> minInput; ofParameter<vector<float>> maxInput; ofParameter<vector<float>> minOutput; ofParameter<vector<float>> maxOutput; ofParameter<vector<float>> output; }; #endif /* mapper_h */
17.435897
48
0.672059
[ "vector" ]
55d77693b06e66ef78f1afe3c6e8e0b822c4ddef
1,109
h
C
src/ios/GrabbaDriver.framework/Headers/GRGrabbaPassportDelegate.h
InLoop-TOCA/GrabbaPluginForCordova
a040d00fe298fc1d7314ce893098c7062d083545
[ "FSFAP" ]
1
2019-04-11T01:38:02.000Z
2019-04-11T01:38:02.000Z
src/ios/GrabbaDriver.framework/Headers/GRGrabbaPassportDelegate.h
InLoop-TOCA/GrabbaPluginForCordova
a040d00fe298fc1d7314ce893098c7062d083545
[ "FSFAP" ]
null
null
null
src/ios/GrabbaDriver.framework/Headers/GRGrabbaPassportDelegate.h
InLoop-TOCA/GrabbaPluginForCordova
a040d00fe298fc1d7314ce893098c7062d083545
[ "FSFAP" ]
null
null
null
// // GRGrabbaPassportDelegate.h // GrabbaDriver // // Created by Murray Hughes on 22/12/10. // Copyright 2010 Grabba International. All rights reserved. // #import <Foundation/Foundation.h> /** * The <VAR>GRGrabbaPassportDelegate</VAR> protocol defines the methods a delegate of an {@link GRGrabbaPassport} * object should implement. The delegate implements the events related to passport swipiing including * the collected passport data. * */ @protocol GRGrabbaPassportDelegate <NSObject> @optional /** * Sent to the delegate when a passport is successfully swiped. * * @param passportString The actual raw passport data collected. */ - (void) passportDidReceiveDataString: (NSString*) passportString; /** * Sent to the delegate when a passport is successfully swiped. * * @param passportString The actual formatted passport data collected */ - (void) passportDidReceiveFormattedDataString: (NSString*) passportString; /** * Sent to the delegate when a passport is failed to swipe. * * @param error Swipe error. */ - (void) passportDidFailWithError:(NSError*) error; @end
25.204545
113
0.743913
[ "object" ]
55db00045bcb049437a12b3c79bc1dbe73142309
766
h
C
src/libvoxelbot/utilities/unit_data_caching.h
eladyaniv01/MicroMachine
dbf8d09f7c3400ed4f2e1b4b2c6c0405928d5807
[ "MIT" ]
1
2020-06-15T19:41:45.000Z
2020-06-15T19:41:45.000Z
src/libvoxelbot/utilities/unit_data_caching.h
eladyaniv01/MicroMachine
dbf8d09f7c3400ed4f2e1b4b2c6c0405928d5807
[ "MIT" ]
null
null
null
src/libvoxelbot/utilities/unit_data_caching.h
eladyaniv01/MicroMachine
dbf8d09f7c3400ed4f2e1b4b2c6c0405928d5807
[ "MIT" ]
null
null
null
#include "sc2api/sc2_api.h" #include <iostream> #include <fstream> #include <vector> const std::string UNIT_DATA_CACHE_PATH = "sc2-libvoxelbot/libvoxelbot/generated/units.data"; const std::string UPGRADE_DATA_CACHE_PATH = "sc2-libvoxelbot/libvoxelbot/generated/upgrades.bin"; const std::string ABILITY_DATA_CACHE_PATH = "sc2-libvoxelbot/libvoxelbot/generated/abilities.bin"; void save_unit_data(const std::vector<sc2::UnitTypeData>& unit_types, std::string path=UNIT_DATA_CACHE_PATH); std::vector<sc2::UnitTypeData> load_unit_data(); void save_ability_data(std::vector<sc2::AbilityData> abilities); void save_upgrade_data(std::vector<sc2::UpgradeData> upgrades); std::vector<sc2::AbilityData> load_ability_data(); std::vector<sc2::UpgradeData> load_upgrade_data();
51.066667
109
0.806789
[ "vector" ]
55df89ca7f37ba51037da5499add16c0aa7ea182
2,721
h
C
xmlInput/ExecutionXmlReader.h
GuillaumeVDu/MTUSpline
13ce7b2e52b820312c29464cb5560bdca446b252
[ "BSD-3-Clause" ]
2
2019-07-25T18:09:42.000Z
2019-09-08T16:02:18.000Z
xmlInput/ExecutionXmlReader.h
GuillaumeVDu/MTUSpline
13ce7b2e52b820312c29464cb5560bdca446b252
[ "BSD-3-Clause" ]
null
null
null
xmlInput/ExecutionXmlReader.h
GuillaumeVDu/MTUSpline
13ce7b2e52b820312c29464cb5560bdca446b252
[ "BSD-3-Clause" ]
null
null
null
// This source code is part of: // "Calibrated EMG-Informed Neuromusculoskeletal Modeling (CEINMS) Toolbox". // Copyright (C) 2015 David G. Lloyd, Monica Reggiani, Massimo Sartori, Claudio Pizzolato // // CEINMS is not free software. You can not redistribute it without the consent of the authors. // The recipient of this software shall provide the authors with a full set of software, // with the source code, and related documentation in the vent of modifications and/or additional developments to CEINMS. // // The methododologies and ideas implemented in this code are described in the manuscripts below, which should be cited in all publications making use of this code: // Sartori M., Reggiani M., Farina D., Lloyd D.G., (2012) "EMG-Driven Forward-Dynamic Estimation of Muscle Force and Joint Moment about Multiple Degrees of Freedom in the Human Lower Extremity," PLoS ONE 7(12): e52618. doi:10.1371/journal.pone.0052618 // Sartori M., Farina D., Lloyd D.G., (2014) “Hybrid neuromusculoskeletal modeling to best track joint moments using a balance between muscle excitations derived from electromyograms and optimization,” J. Biomech., vol. 47, no. 15, pp. 3613–3621, // // Please, contact the authors to receive a copy of the "non-disclosure" and "material transfer" agreements: // email: david.lloyd@griffith.edu.au, monica.reggiani@gmail.com, massimo.srt@gmail.com, claudio.pizzolato.uni@gmail.com #ifndef ExecutionXmlReader_h #define ExecutionXmlReader_h #include <string> #include <vector> #include "NMSmodelConfig.h" #include "execution.hxx" class ExecutionXmlReader { public: ExecutionXmlReader(const std::string& filename); NMSModelCfg::RunMode getRunMode() const; void getMusclesToPredict(std::vector<std::string>& musclesToPredict); void getMusclesToTrack(std::vector<std::string>& musclesToTrack); void getHybridWeightings(double& alpha, double& beta, double& gamma); // void getDynLib(std::string& EMGDynLib, std::string& angleDynLib) const; bool isRealTime(); std::string getNameOfSubject(); std::string getAnglePlugin(); std::string getAngleFile(); std::string getEmgPlugin(); std::string getEmgFile(); std::string getComsumerPlugin(); std::string getAngleAndComsumerPlugin(); std::string getComsumerPort(); std::string getOptimizationPlugin(); std::string getOptimizationFile(); std::string getEMGAndAnglePlugin(); bool useOfAnglePlugin(); bool useOfEmgPlugin(); bool useOfComsumerPlugin(); bool useOfAngleAndComsumerPlugin(); bool useOfOptimizationPlugin(); bool useOfEMGAndAnglePlugin(); private: void readXml(); unsigned runMode_; std::auto_ptr<ExecutionType> executionPointer_; bool isRealTime_; }; #endif
42.515625
251
0.758912
[ "vector" ]
55dfbc399a19e90e69515e97c9becbe398ccb54f
964
h
C
lib/include/cppunit/TextTestProgressListener.h
LaroyenneG/Fuzzy-Logic
0d2911c02b5bd4eedcca42925e7e35c5dd450bf8
[ "Apache-2.0" ]
null
null
null
lib/include/cppunit/TextTestProgressListener.h
LaroyenneG/Fuzzy-Logic
0d2911c02b5bd4eedcca42925e7e35c5dd450bf8
[ "Apache-2.0" ]
null
null
null
lib/include/cppunit/TextTestProgressListener.h
LaroyenneG/Fuzzy-Logic
0d2911c02b5bd4eedcca42925e7e35c5dd450bf8
[ "Apache-2.0" ]
null
null
null
#ifndef CPPUNIT_TEXTTESTPROGRESSLISTENER_H #define CPPUNIT_TEXTTESTPROGRESSLISTENER_H #include <cppunit/TestListener.h> CPPUNIT_NS_BEGIN /*! * \brief TestListener that show the status of each TestCase test result. * \ingroup TrackingTestExecution */ class CPPUNIT_API TextTestProgressListener : public TestListener { public: /*! Constructs a TextTestProgressListener object. */ TextTestProgressListener(); /// Destructor. virtual ~TextTestProgressListener(); void startTest(Test *test); void addFailure(const TestFailure &failure); void endTestRun(Test *test, TestResult *eventManager); private: /// Prevents the use of the copy constructor. TextTestProgressListener(const TextTestProgressListener &copy); /// Prevents the use of the copy operator. void operator=(const TextTestProgressListener &copy); private: }; CPPUNIT_NS_END #endif // CPPUNIT_TEXTTESTPROGRESSLISTENER_H
21.909091
73
0.741701
[ "object" ]
55e01edea43b21015538465317bb7e362617aff0
1,883
h
C
content/public/test/test_web_contents_factory.h
google-ar/chromium
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
777
2017-08-29T15:15:32.000Z
2022-03-21T05:29:41.000Z
content/public/test/test_web_contents_factory.h
harrymarkovskiy/WebARonARCore
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
66
2017-08-30T18:31:18.000Z
2021-08-02T10:59:35.000Z
content/public/test/test_web_contents_factory.h
harrymarkovskiy/WebARonARCore
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
123
2017-08-30T01:19:34.000Z
2022-03-17T22:55:31.000Z
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_PUBLIC_TEST_TEST_WEB_CONTENTS_FACTORY_H_ #define CONTENT_PUBLIC_TEST_TEST_WEB_CONTENTS_FACTORY_H_ #include <memory> #include "base/macros.h" #include "base/memory/scoped_vector.h" namespace content { class BrowserContext; class RenderViewHostTestEnabler; class WebContents; // A helper class to create test web contents (tabs) for unit tests, without // inheriting from RenderViewTestHarness. Can create web contents, and will // clean up after itself upon destruction. Owns all created web contents. // A few notes: // - Works well allocated on the stack, because it should be destroyed before // associated browser context. // - Doesn't play nice with web contents created any other way (because of // the implementation of RenderViewHostTestEnabler). But if you are creating // web contents already, what do you need this for? ;) // TODO(devlin): The API is currently a bit sparse; there may need to be methods // to, e.g., delete/close a web contents, access existing web contents, etc. // These can be added as-needed. class TestWebContentsFactory { public: TestWebContentsFactory(); ~TestWebContentsFactory(); // Creates a new WebContents with the given |context|, and returns it. // Ownership remains with the TestWebContentsFactory. WebContents* CreateWebContents(BrowserContext* context); private: // The test factory (and friends) for creating test web contents. std::unique_ptr<RenderViewHostTestEnabler> rvh_enabler_; // The vector of web contents that this class created. ScopedVector<WebContents> web_contents_; DISALLOW_COPY_AND_ASSIGN(TestWebContentsFactory); }; } // namespace content #endif // CONTENT_PUBLIC_TEST_TEST_WEB_CONTENTS_FACTORY_H_
36.211538
80
0.778545
[ "vector" ]
55e1ebf6e539e23ca405c91fd82e2685473ecf60
8,707
h
C
MonoNative/mscorlib/System/Security/mscorlib_System_Security_NamedPermissionSet.h
brunolauze/MonoNative
959fb52c2c1ffe87476ab0d6e4fcce0ad9ce1e66
[ "BSD-2-Clause" ]
7
2015-03-10T03:36:16.000Z
2021-11-05T01:16:58.000Z
MonoNative/mscorlib/System/Security/mscorlib_System_Security_NamedPermissionSet.h
brunolauze/MonoNative
959fb52c2c1ffe87476ab0d6e4fcce0ad9ce1e66
[ "BSD-2-Clause" ]
1
2020-06-23T10:02:33.000Z
2020-06-24T02:05:47.000Z
MonoNative/mscorlib/System/Security/mscorlib_System_Security_NamedPermissionSet.h
brunolauze/MonoNative
959fb52c2c1ffe87476ab0d6e4fcce0ad9ce1e66
[ "BSD-2-Clause" ]
null
null
null
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_SECURITY_NAMEDPERMISSIONSET_H #define __MONO_NATIVE_MSCORLIB_SYSTEM_SECURITY_NAMEDPERMISSIONSET_H #include <mscorlib/System/Security/mscorlib_System_Security_PermissionSet.h> #include <mscorlib/System/mscorlib_System_String.h> #include <mscorlib/System/Security/Permissions/mscorlib_System_Security_Permissions_PermissionState.h> #include <mscorlib/System/Runtime/Serialization/mscorlib_System_Runtime_Serialization_IDeserializationCallback.h> #include <mscorlib/System/Collections/mscorlib_System_Collections_ICollection.h> #include <mscorlib/System/Security/mscorlib_System_Security_ISecurityEncodable.h> #include <mscorlib/System/Security/mscorlib_System_Security_IStackWalk.h> #include <mscorlib/System/Collections/mscorlib_System_Collections_IEnumerable.h> #include <mscorlib/System/mscorlib_System_Object.h> #include <mscorlib/System/Security/mscorlib_System_Security_IPermission.h> #include <mscorlib/System/Collections/mscorlib_System_Collections_IEnumerator.h> namespace mscorlib { namespace System { namespace Security { class SecurityElement; } } } namespace mscorlib { namespace System { class Array; class Type; } } namespace mscorlib { namespace System { namespace Security { class NamedPermissionSet : public mscorlib::System::Security::PermissionSet , public virtual mscorlib::System::Runtime::Serialization::IDeserializationCallback , public virtual mscorlib::System::Collections::ICollection , public virtual mscorlib::System::Security::ISecurityEncodable , public virtual mscorlib::System::Security::IStackWalk , public virtual mscorlib::System::Collections::IEnumerable { public: NamedPermissionSet(mscorlib::System::String name, mscorlib::System::Security::PermissionSet permSet) : mscorlib::System::Security::PermissionSet(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.NamedPermissionSet")) , mscorlib::System::Runtime::Serialization::IDeserializationCallback(NULL) , mscorlib::System::Collections::ICollection(NULL) , mscorlib::System::Security::ISecurityEncodable(NULL) , mscorlib::System::Security::IStackWalk(NULL) , mscorlib::System::Collections::IEnumerable(NULL) { MonoType *__parameter_types__[2]; void *__parameters__[2]; __parameter_types__[0] = Global::GetType("mscorlib", "System", "String"); __parameter_types__[1] = Global::GetType("mscorlib", "System.Security", "PermissionSet"); __parameters__[0] = (MonoObject*)name; __parameters__[1] = (MonoObject*)permSet; __native_object__ = Global::New("mscorlib", "System.Security", "NamedPermissionSet", 2, __parameter_types__, __parameters__); }; NamedPermissionSet(mscorlib::System::String name, mscorlib::System::Security::Permissions::PermissionState::__ENUM__ state) : mscorlib::System::Security::PermissionSet(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.NamedPermissionSet")) , mscorlib::System::Runtime::Serialization::IDeserializationCallback(NULL) , mscorlib::System::Collections::ICollection(NULL) , mscorlib::System::Security::ISecurityEncodable(NULL) , mscorlib::System::Security::IStackWalk(NULL) , mscorlib::System::Collections::IEnumerable(NULL) { MonoType *__parameter_types__[2]; void *__parameters__[2]; __parameter_types__[0] = Global::GetType("mscorlib", "System", "String"); __parameter_types__[1] = Global::GetType("mscorlib", "System.Security.Permissions", "PermissionState"); __parameters__[0] = (MonoObject*)name; mscorlib::System::Int32 __param_state__ = state; __parameters__[1] = &__param_state__; __native_object__ = Global::New("mscorlib", "System.Security", "NamedPermissionSet", 2, __parameter_types__, __parameters__); }; NamedPermissionSet(mscorlib::System::Security::NamedPermissionSet &permSet) : mscorlib::System::Security::PermissionSet(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.NamedPermissionSet")) , mscorlib::System::Runtime::Serialization::IDeserializationCallback(NULL) , mscorlib::System::Collections::ICollection(NULL) , mscorlib::System::Security::ISecurityEncodable(NULL) , mscorlib::System::Security::IStackWalk(NULL) , mscorlib::System::Collections::IEnumerable(NULL) { MonoType *__parameter_types__[1]; void *__parameters__[1]; __parameter_types__[0] = Global::GetType("mscorlib", "System.Security", "NamedPermissionSet"); __parameters__[0] = (MonoObject*)permSet; __native_object__ = Global::New("mscorlib", "System.Security", "NamedPermissionSet", 1, __parameter_types__, __parameters__); }; NamedPermissionSet(mscorlib::System::String name) : mscorlib::System::Security::PermissionSet(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.NamedPermissionSet")) , mscorlib::System::Runtime::Serialization::IDeserializationCallback(NULL) , mscorlib::System::Collections::ICollection(NULL) , mscorlib::System::Security::ISecurityEncodable(NULL) , mscorlib::System::Security::IStackWalk(NULL) , mscorlib::System::Collections::IEnumerable(NULL) { MonoType *__parameter_types__[1]; void *__parameters__[1]; __parameter_types__[0] = Global::GetType("mscorlib", "System", "String"); __parameters__[0] = (MonoObject*)name; __native_object__ = Global::New("mscorlib", "System.Security", "NamedPermissionSet", 1, __parameter_types__, __parameters__); }; NamedPermissionSet(mscorlib::NativeTypeInfo *nativeTypeInfo) : mscorlib::System::Security::PermissionSet(nativeTypeInfo) , mscorlib::System::Runtime::Serialization::IDeserializationCallback(NULL) , mscorlib::System::Collections::ICollection(NULL) , mscorlib::System::Security::ISecurityEncodable(NULL) , mscorlib::System::Security::IStackWalk(NULL) , mscorlib::System::Collections::IEnumerable(NULL) { }; NamedPermissionSet(MonoObject *nativeObject) : mscorlib::System::Security::PermissionSet(nativeObject) , mscorlib::System::Runtime::Serialization::IDeserializationCallback(nativeObject) , mscorlib::System::Collections::ICollection(nativeObject) , mscorlib::System::Security::ISecurityEncodable(nativeObject) , mscorlib::System::Security::IStackWalk(nativeObject) , mscorlib::System::Collections::IEnumerable(nativeObject) { }; ~NamedPermissionSet() { }; NamedPermissionSet & operator=(NamedPermissionSet &value) { __native_object__ = value.GetNativeObject(); return value; }; bool operator==(NamedPermissionSet &value) { return mscorlib::System::Object::Equals(value); }; operator MonoObject*() { return __native_object__; }; MonoObject* operator=(MonoObject* value) { return __native_object__ = value; }; virtual mscorlib::System::Security::PermissionSet Copy() override; mscorlib::System::Security::NamedPermissionSet Copy(mscorlib::System::String name); mscorlib::System::Security::NamedPermissionSet Copy(const char *name); virtual void FromXml(mscorlib::System::Security::SecurityElement et) override; virtual mscorlib::System::Security::SecurityElement ToXml() override; virtual mscorlib::System::Boolean Equals(mscorlib::System::Object obj) override; virtual mscorlib::System::Int32 GetHashCode() override; virtual MonoObject* GetNativeObject() override { return __native_object__; }; //Public Properties __declspec(property(get=get_Description, put=set_Description)) mscorlib::System::String Description; __declspec(property(get=get_Name, put=set_Name)) mscorlib::System::String Name; __declspec(property(get=get_Count)) mscorlib::System::Int32 Count; __declspec(property(get=get_IsSynchronized)) mscorlib::System::Boolean IsSynchronized; __declspec(property(get=get_IsReadOnly)) mscorlib::System::Boolean IsReadOnly; __declspec(property(get=get_SyncRoot)) mscorlib::System::Object SyncRoot; //Get Set Properties Methods // Get/Set:Description mscorlib::System::String get_Description() const; void set_Description(mscorlib::System::String value); // Get/Set:Name mscorlib::System::String get_Name() const; void set_Name(mscorlib::System::String value); // Get:Count mscorlib::System::Int32 get_Count() const; // Get:IsSynchronized mscorlib::System::Boolean get_IsSynchronized() const; // Get:IsReadOnly mscorlib::System::Boolean get_IsReadOnly() const; // Get:SyncRoot mscorlib::System::Object get_SyncRoot() const; protected: private: }; } } } #endif
43.10396
135
0.746181
[ "object" ]
55e5f737f8bfd3664262806b5f53aa0f5337ebff
7,645
c
C
src/_fastqandfurious.c
lgautier/fastqandfurious
ee7d9f1d50f773f373bca443261524e237e5ad23
[ "MIT" ]
57
2017-01-30T14:37:11.000Z
2022-03-08T03:48:38.000Z
src/_fastqandfurious.c
lgautier/fastqandfurious
ee7d9f1d50f773f373bca443261524e237e5ad23
[ "MIT" ]
9
2017-02-01T17:29:41.000Z
2020-01-29T19:50:06.000Z
src/_fastqandfurious.c
lgautier/fastqandfurious
ee7d9f1d50f773f373bca443261524e237e5ad23
[ "MIT" ]
6
2018-02-20T03:39:45.000Z
2020-10-25T13:08:58.000Z
#define PY_SSIZE_T_CLEAN #include <Python.h> #include <stdio.h> #include <string.h> #define INVALID -1 #define POS_HEAD_BEG 0 #define POS_HEAD_END 1 #define POS_SEQ_BEG 2 #define POS_SEQ_END 3 #define POS_QUAL_BEG 4 #define POS_QUAL_END 5 #define COMPLETE 6 #define MISSING_QUALHEADER_END 7 PyDoc_STRVAR(entrypos_doc, "entrypos(blob, backlog, posbuffer) -> int\n\n" "Compute the positions for the next FASTQ entry given " "- blob: a bytes-like object\n" "- backlog: a bytes-like object\n" "- posbuffer: a buffer able to store 6 positions"); static PyObject * entrypos(PyObject * self, PyObject * args) { Py_buffer blob; Py_ssize_t offset; Py_buffer posbuffer; if (!PyArg_ParseTuple(args, "s*Ly*", &blob, &offset, &posbuffer)) { return NULL; } char * blob_char = (char *)blob.buf; if (posbuffer.itemsize != sizeof(signed long long)) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); PyErr_SetString(PyExc_ValueError, "The buffer must be of format type q."); return NULL; } Py_ssize_t cur_offset = offset; /* posarray is an array with 6 offsets: * - 0: header, begin * - 1: header, end * - 2: sequence, begin * - 3: sequence, end * - 4: quality, begin * - 5: quality, end */ Py_ssize_t * posarray = (Py_ssize_t *) posbuffer.buf; /* initialize the buffer */ for (Py_ssize_t i = 0; i < 6; i++) { posarray[i] = -1; } /* header */ char * headerbeg_adr = (char *)memmem((void *)(blob_char + cur_offset), blob.len - cur_offset, (void *)("\n@"), 2); if (headerbeg_adr == NULL) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(POS_HEAD_BEG); } posarray[POS_HEAD_BEG] = (Py_ssize_t) (headerbeg_adr - blob_char + 1); cur_offset = posarray[POS_HEAD_BEG]+1; char * headerend_adr = (char *)memchr(blob_char + cur_offset, '\n', blob.len - cur_offset - 1); if (headerend_adr == NULL) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(POS_HEAD_END); } posarray[POS_HEAD_END] = (Py_ssize_t) (headerend_adr - blob_char); /* sequence */ if (posarray[POS_HEAD_END]+1 >= blob.len) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(POS_SEQ_BEG); } posarray[POS_SEQ_BEG] = posarray[POS_HEAD_END] + 1; cur_offset = posarray[POS_SEQ_BEG]+1; char * seqend_adr = (char *)memmem((void *)(blob_char + cur_offset), blob.len - cur_offset, (void *)("\n+"), 2); if (seqend_adr == NULL) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(POS_SEQ_END); } posarray[POS_SEQ_END] = (Py_ssize_t) (seqend_adr - blob_char); /* Quality */ if (posarray[POS_SEQ_END]+2 >= blob.len) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(MISSING_QUALHEADER_END); } cur_offset = posarray[POS_SEQ_END]+2; char * qualheadend_adr = (char *)memchr(blob_char + cur_offset, '\n', blob.len - cur_offset - 1); if (qualheadend_adr == NULL) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(MISSING_QUALHEADER_END); } if ( ((qualheadend_adr - blob_char - posarray[POS_SEQ_END] - 1) > 1) && ((qualheadend_adr - blob_char - posarray[POS_SEQ_END]) != (posarray[POS_HEAD_END] - posarray[POS_HEAD_BEG] + 1)) ) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(INVALID); } Py_ssize_t qualbeg_i = qualheadend_adr - blob_char +1; if (qualbeg_i >= blob.len) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(POS_QUAL_BEG); } else { posarray[POS_QUAL_BEG] = qualbeg_i; } Py_ssize_t qualend_i = (posarray[POS_QUAL_BEG] + posarray[POS_SEQ_END] - posarray[POS_HEAD_END] - 1); if ((qualend_i+2) >= blob.len) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(POS_QUAL_END); } else { posarray[POS_QUAL_END] = qualend_i; } if (!( ((qualend_i-posarray[POS_QUAL_BEG]) != (posarray[POS_SEQ_END]+1 - posarray[POS_HEAD_END])) || ((! (qualend_i+2 >= blob.len)) && blob_char[qualend_i] == '\n' && blob_char[qualend_i+1] == '@') || (blob.len - qualend_i) ) ) { PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(INVALID); } PyBuffer_Release(&blob); PyBuffer_Release(&posbuffer); return PyLong_FromLong(COMPLETE); } PyDoc_STRVAR(arrayadd_b_doc, "arrayadd_b(a, offset)" "Add the integer value to each value in the array **in-place**." "- a: an array (or any object with the buffer interface) with elements of type 'b'\n" "- value: a signed integer\n"); static PyObject * arrayadd_b(PyObject * self, PyObject * args) { Py_buffer buf; signed char value; if (!PyArg_ParseTuple(args, "y*h", &buf, &value)) { return NULL; } if (buf.itemsize != sizeof(signed char)) { PyBuffer_Release(&buf); PyErr_SetString(PyExc_ValueError, "The buffer must be of format type b."); return NULL; } signed char * bufarray = (signed char *) buf.buf; const Py_ssize_t buflen = buf.len / buf.itemsize; /* initialize the buffer */ for (Py_ssize_t i = 0; i < buflen; i++) { bufarray[i] += value; } Py_RETURN_NONE; } PyDoc_STRVAR(arrayadd_q_doc, "arrayadd_q(a, offset)" "Add the integer value to each value in the array **in-place**." "- a: an array (or any object with the buffer interface) with elements of type 'q'\n" "- value: a signed integer\n"); static PyObject * arrayadd_q(PyObject * self, PyObject * args) { Py_buffer buf; long long value; if (!PyArg_ParseTuple(args, "y*L", &buf, &value)) { return NULL; } if (buf.itemsize != sizeof(unsigned long long)) { PyBuffer_Release(&buf); PyErr_SetString(PyExc_ValueError, "The buffer must be of format type q."); return NULL; } unsigned long long * bufarray = (unsigned long long *) buf.buf; const Py_ssize_t buflen = buf.len / buf.itemsize; /* initialize the buffer */ for (Py_ssize_t i = 0; i < buflen; i++) { bufarray[i] += value; } Py_RETURN_NONE; } static PyMethodDef fastqandfuriousModuleMethods[] = { { "entrypos", (PyCFunction)entrypos, METH_VARARGS, entrypos_doc, }, { "arrayadd_b", (PyCFunction)arrayadd_b, METH_VARARGS, arrayadd_b_doc, }, { "arrayadd_q", (PyCFunction)arrayadd_q, METH_VARARGS, arrayadd_q_doc, }, { NULL} // sentinel }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_fastqandfurious", "Utilities to handle FASTQ data.", -1, fastqandfuriousModuleMethods}; PyMODINIT_FUNC PyInit__fastqandfurious(void) { PyObject *m; m = PyModule_Create(&moduledef); if (m == NULL) { return NULL; } PyModule_AddObject(m, "INVALID", PyLong_FromLong(INVALID)); PyModule_AddObject(m, "POS_HEAD_BEG", PyLong_FromLong(POS_HEAD_BEG)); PyModule_AddObject(m, "POS_HEAD_END", PyLong_FromLong(POS_HEAD_END)); PyModule_AddObject(m, "POS_SEQ_BEG", PyLong_FromLong(POS_SEQ_BEG)); PyModule_AddObject(m, "POS_SEQ_END", PyLong_FromLong(POS_SEQ_END)); PyModule_AddObject(m, "POS_QUAL_BEG", PyLong_FromLong(POS_QUAL_BEG)); PyModule_AddObject(m, "POS_QUAL_END", PyLong_FromLong(POS_QUAL_END)); PyModule_AddObject(m, "COMPLETE", PyLong_FromLong(COMPLETE)); PyModule_AddObject(m, "MISSING_QUALHEADER_END", PyLong_FromLong(MISSING_QUALHEADER_END)); return m; }
28.740602
118
0.667364
[ "object" ]
55fa31d82c9e39883abec75c8a3a623451d751d8
4,202
h
C
content/browser/utility_process_host_impl.h
google-ar/chromium
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
777
2017-08-29T15:15:32.000Z
2022-03-21T05:29:41.000Z
content/browser/utility_process_host_impl.h
harrymarkovskiy/WebARonARCore
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
66
2017-08-30T18:31:18.000Z
2021-08-02T10:59:35.000Z
content/browser/utility_process_host_impl.h
harrymarkovskiy/WebARonARCore
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
123
2017-08-30T01:19:34.000Z
2022-03-17T22:55:31.000Z
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ #include <memory> #include <string> #include <vector> #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "content/public/browser/browser_child_process_host_delegate.h" #include "content/public/browser/utility_process_host.h" namespace base { class SequencedTaskRunner; class Thread; } namespace content { class BrowserChildProcessHostImpl; class InProcessChildThreadParams; typedef base::Thread* (*UtilityMainThreadFactoryFunction)( const InProcessChildThreadParams&); class CONTENT_EXPORT UtilityProcessHostImpl : public NON_EXPORTED_BASE(UtilityProcessHost), public BrowserChildProcessHostDelegate { public: static void RegisterUtilityMainThreadFactory( UtilityMainThreadFactoryFunction create); UtilityProcessHostImpl( const scoped_refptr<UtilityProcessHostClient>& client, const scoped_refptr<base::SequencedTaskRunner>& client_task_runner); ~UtilityProcessHostImpl() override; // UtilityProcessHost implementation: base::WeakPtr<UtilityProcessHost> AsWeakPtr() override; bool Send(IPC::Message* message) override; bool StartBatchMode() override; void EndBatchMode() override; void SetExposedDir(const base::FilePath& dir) override; void DisableSandbox() override; #if defined(OS_WIN) void ElevatePrivileges() override; #endif const ChildProcessData& GetData() override; #if defined(OS_POSIX) void SetEnv(const base::EnvironmentMap& env) override; #endif bool Start() override; service_manager::InterfaceProvider* GetRemoteInterfaces() override; void SetName(const base::string16& name) override; void set_child_flags(int flags) { child_flags_ = flags; } #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) // Launch the zygote early in the browser startup. static void EarlyZygoteLaunch(); #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) private: // Starts a process if necessary. Returns true if it succeeded or a process // has already been started via StartBatchMode(). bool StartProcess(); // BrowserChildProcessHost: bool OnMessageReceived(const IPC::Message& message) override; void OnProcessLaunchFailed(int error_code) override; void OnProcessCrashed(int exit_code) override; // Cleans up |this| as a result of a failed Start(). void NotifyAndDelete(int error_code); // Notifies the client that the launch failed and deletes |host|. static void NotifyLaunchFailedAndDelete( base::WeakPtr<UtilityProcessHostImpl> host, int error_code); // A pointer to our client interface, who will be informed of progress. scoped_refptr<UtilityProcessHostClient> client_; scoped_refptr<base::SequencedTaskRunner> client_task_runner_; // True when running in batch mode, i.e., StartBatchMode() has been called // and the utility process will run until EndBatchMode(). bool is_batch_mode_; base::FilePath exposed_dir_; // Whether to pass switches::kNoSandbox to the child. bool no_sandbox_; // Whether to launch the process with elevated privileges. bool run_elevated_; // Flags defined in ChildProcessHost with which to start the process. int child_flags_; base::EnvironmentMap env_; bool started_; // A user-visible name identifying this process. Used to indentify this // process in the task manager. base::string16 name_; std::unique_ptr<BrowserChildProcessHostImpl> process_; // Used in single-process mode instead of process_. std::unique_ptr<base::Thread> in_process_thread_; // Used to vend weak pointers, and should always be declared last. base::WeakPtrFactory<UtilityProcessHostImpl> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); }; } // namespace content #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_
32.828125
78
0.776059
[ "vector" ]
360568b4a62059c28b22f1192bb15ddcde8f10cd
131,447
c
C
src/intel/vulkan/genX_cmd_buffer.c
antmicro/kvm-aosp-external-mesa3d
9a3a0c1e30421cd1d66b138ef6a3269ceb6de39f
[ "MIT" ]
null
null
null
src/intel/vulkan/genX_cmd_buffer.c
antmicro/kvm-aosp-external-mesa3d
9a3a0c1e30421cd1d66b138ef6a3269ceb6de39f
[ "MIT" ]
null
null
null
src/intel/vulkan/genX_cmd_buffer.c
antmicro/kvm-aosp-external-mesa3d
9a3a0c1e30421cd1d66b138ef6a3269ceb6de39f
[ "MIT" ]
null
null
null
/* * Copyright © 2015 Intel Corporation * * 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 (including the next * paragraph) 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. */ #include <assert.h> #include <stdbool.h> #include "anv_private.h" #include "vk_format_info.h" #include "vk_util.h" #include "common/gen_l3_config.h" #include "genxml/gen_macros.h" #include "genxml/genX_pack.h" static void emit_lrm(struct anv_batch *batch, uint32_t reg, struct anv_bo *bo, uint32_t offset) { anv_batch_emit(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { lrm.RegisterAddress = reg; lrm.MemoryAddress = (struct anv_address) { bo, offset }; } } static void emit_lri(struct anv_batch *batch, uint32_t reg, uint32_t imm) { anv_batch_emit(batch, GENX(MI_LOAD_REGISTER_IMM), lri) { lri.RegisterOffset = reg; lri.DataDWord = imm; } } #if GEN_IS_HASWELL || GEN_GEN >= 8 static void emit_lrr(struct anv_batch *batch, uint32_t dst, uint32_t src) { anv_batch_emit(batch, GENX(MI_LOAD_REGISTER_REG), lrr) { lrr.SourceRegisterAddress = src; lrr.DestinationRegisterAddress = dst; } } #endif void genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer) { struct anv_device *device = cmd_buffer->device; /* Emit a render target cache flush. * * This isn't documented anywhere in the PRM. However, it seems to be * necessary prior to changing the surface state base adress. Without * this, we get GPU hangs when using multi-level command buffers which * clear depth, reset state base address, and then go render stuff. */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.DCFlushEnable = true; pc.RenderTargetCacheFlushEnable = true; pc.CommandStreamerStallEnable = true; } anv_batch_emit(&cmd_buffer->batch, GENX(STATE_BASE_ADDRESS), sba) { sba.GeneralStateBaseAddress = (struct anv_address) { NULL, 0 }; sba.GeneralStateMemoryObjectControlState = GENX(MOCS); sba.GeneralStateBaseAddressModifyEnable = true; sba.SurfaceStateBaseAddress = anv_cmd_buffer_surface_base_address(cmd_buffer); sba.SurfaceStateMemoryObjectControlState = GENX(MOCS); sba.SurfaceStateBaseAddressModifyEnable = true; sba.DynamicStateBaseAddress = (struct anv_address) { &device->dynamic_state_pool.block_pool.bo, 0 }; sba.DynamicStateMemoryObjectControlState = GENX(MOCS); sba.DynamicStateBaseAddressModifyEnable = true; sba.IndirectObjectBaseAddress = (struct anv_address) { NULL, 0 }; sba.IndirectObjectMemoryObjectControlState = GENX(MOCS); sba.IndirectObjectBaseAddressModifyEnable = true; sba.InstructionBaseAddress = (struct anv_address) { &device->instruction_state_pool.block_pool.bo, 0 }; sba.InstructionMemoryObjectControlState = GENX(MOCS); sba.InstructionBaseAddressModifyEnable = true; # if (GEN_GEN >= 8) /* Broadwell requires that we specify a buffer size for a bunch of * these fields. However, since we will be growing the BO's live, we * just set them all to the maximum. */ sba.GeneralStateBufferSize = 0xfffff; sba.GeneralStateBufferSizeModifyEnable = true; sba.DynamicStateBufferSize = 0xfffff; sba.DynamicStateBufferSizeModifyEnable = true; sba.IndirectObjectBufferSize = 0xfffff; sba.IndirectObjectBufferSizeModifyEnable = true; sba.InstructionBufferSize = 0xfffff; sba.InstructionBuffersizeModifyEnable = true; # endif } /* After re-setting the surface state base address, we have to do some * cache flusing so that the sampler engine will pick up the new * SURFACE_STATE objects and binding tables. From the Broadwell PRM, * Shared Function > 3D Sampler > State > State Caching (page 96): * * Coherency with system memory in the state cache, like the texture * cache is handled partially by software. It is expected that the * command stream or shader will issue Cache Flush operation or * Cache_Flush sampler message to ensure that the L1 cache remains * coherent with system memory. * * [...] * * Whenever the value of the Dynamic_State_Base_Addr, * Surface_State_Base_Addr are altered, the L1 state cache must be * invalidated to ensure the new surface or sampler state is fetched * from system memory. * * The PIPE_CONTROL command has a "State Cache Invalidation Enable" bit * which, according the PIPE_CONTROL instruction documentation in the * Broadwell PRM: * * Setting this bit is independent of any other bit in this packet. * This bit controls the invalidation of the L1 and L2 state caches * at the top of the pipe i.e. at the parsing time. * * Unfortunately, experimentation seems to indicate that state cache * invalidation through a PIPE_CONTROL does nothing whatsoever in * regards to surface state and binding tables. In stead, it seems that * invalidating the texture cache is what is actually needed. * * XXX: As far as we have been able to determine through * experimentation, shows that flush the texture cache appears to be * sufficient. The theory here is that all of the sampling/rendering * units cache the binding table in the texture cache. However, we have * yet to be able to actually confirm this. */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.TextureCacheInvalidationEnable = true; pc.ConstantCacheInvalidationEnable = true; pc.StateCacheInvalidationEnable = true; } } static void add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer, struct anv_state state, struct anv_bo *bo, uint32_t offset) { const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev; VkResult result = anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc, state.offset + isl_dev->ss.addr_offset, bo, offset); if (result != VK_SUCCESS) anv_batch_set_error(&cmd_buffer->batch, result); } static void add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer, const struct anv_image_view *image_view, const uint32_t plane, struct anv_surface_state state) { const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev; const struct anv_image *image = image_view->image; uint32_t image_plane = image_view->planes[plane].image_plane; add_surface_state_reloc(cmd_buffer, state.state, image->planes[image_plane].bo, state.address); if (state.aux_address) { VkResult result = anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc, state.state.offset + isl_dev->ss.aux_addr_offset, image->planes[image_plane].bo, state.aux_address); if (result != VK_SUCCESS) anv_batch_set_error(&cmd_buffer->batch, result); } } static bool color_is_zero_one(VkClearColorValue value, enum isl_format format) { if (isl_format_has_int_channel(format)) { for (unsigned i = 0; i < 4; i++) { if (value.int32[i] != 0 && value.int32[i] != 1) return false; } } else { for (unsigned i = 0; i < 4; i++) { if (value.float32[i] != 0.0f && value.float32[i] != 1.0f) return false; } } return true; } static void color_attachment_compute_aux_usage(struct anv_device * device, struct anv_cmd_state * cmd_state, uint32_t att, VkRect2D render_area, union isl_color_value *fast_clear_color) { struct anv_attachment_state *att_state = &cmd_state->attachments[att]; struct anv_image_view *iview = cmd_state->framebuffer->attachments[att]; assert(iview->n_planes == 1); if (iview->planes[0].isl.base_array_layer >= anv_image_aux_layers(iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level)) { /* There is no aux buffer which corresponds to the level and layer(s) * being accessed. */ att_state->aux_usage = ISL_AUX_USAGE_NONE; att_state->input_aux_usage = ISL_AUX_USAGE_NONE; att_state->fast_clear = false; return; } else if (iview->image->planes[0].aux_usage == ISL_AUX_USAGE_MCS) { att_state->aux_usage = ISL_AUX_USAGE_MCS; att_state->input_aux_usage = ISL_AUX_USAGE_MCS; att_state->fast_clear = false; return; } else if (iview->image->planes[0].aux_usage == ISL_AUX_USAGE_CCS_E) { att_state->aux_usage = ISL_AUX_USAGE_CCS_E; att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E; } else { att_state->aux_usage = ISL_AUX_USAGE_CCS_D; /* From the Sky Lake PRM, RENDER_SURFACE_STATE::AuxiliarySurfaceMode: * * "If Number of Multisamples is MULTISAMPLECOUNT_1, AUX_CCS_D * setting is only allowed if Surface Format supported for Fast * Clear. In addition, if the surface is bound to the sampling * engine, Surface Format must be supported for Render Target * Compression for surfaces bound to the sampling engine." * * In other words, we can only sample from a fast-cleared image if it * also supports color compression. */ if (isl_format_supports_ccs_e(&device->info, iview->planes[0].isl.format)) { att_state->input_aux_usage = ISL_AUX_USAGE_CCS_D; /* While fast-clear resolves and partial resolves are fairly cheap in the * case where you render to most of the pixels, full resolves are not * because they potentially involve reading and writing the entire * framebuffer. If we can't texture with CCS_E, we should leave it off and * limit ourselves to fast clears. */ if (cmd_state->pass->attachments[att].first_subpass_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { anv_perf_warn(device->instance, iview->image, "Not temporarily enabling CCS_E."); } } else { att_state->input_aux_usage = ISL_AUX_USAGE_NONE; } } assert(iview->image->planes[0].aux_surface.isl.usage & ISL_SURF_USAGE_CCS_BIT); att_state->clear_color_is_zero_one = color_is_zero_one(att_state->clear_value.color, iview->planes[0].isl.format); att_state->clear_color_is_zero = att_state->clear_value.color.uint32[0] == 0 && att_state->clear_value.color.uint32[1] == 0 && att_state->clear_value.color.uint32[2] == 0 && att_state->clear_value.color.uint32[3] == 0; if (att_state->pending_clear_aspects == VK_IMAGE_ASPECT_COLOR_BIT) { /* Start off assuming fast clears are possible */ att_state->fast_clear = true; /* Potentially, we could do partial fast-clears but doing so has crazy * alignment restrictions. It's easier to just restrict to full size * fast clears for now. */ if (render_area.offset.x != 0 || render_area.offset.y != 0 || render_area.extent.width != iview->extent.width || render_area.extent.height != iview->extent.height) att_state->fast_clear = false; /* On Broadwell and earlier, we can only handle 0/1 clear colors */ if (GEN_GEN <= 8 && !att_state->clear_color_is_zero_one) att_state->fast_clear = false; /* We allow fast clears when all aux layers of the miplevel are targeted. * See add_fast_clear_state_buffer() for more information. Also, because * we only either do a fast clear or a normal clear and not both, this * complies with the gen7 restriction of not fast-clearing multiple * layers. */ if (cmd_state->framebuffer->layers != anv_image_aux_layers(iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level)) { att_state->fast_clear = false; if (GEN_GEN == 7) { anv_perf_warn(device->instance, iview->image, "Not fast-clearing the first layer in " "a multi-layer fast clear."); } } /* We only allow fast clears in the GENERAL layout if the auxiliary * buffer is always enabled and the fast-clear value is all 0's. See * add_fast_clear_state_buffer() for more information. */ if (cmd_state->pass->attachments[att].first_subpass_layout == VK_IMAGE_LAYOUT_GENERAL && (!att_state->clear_color_is_zero || iview->image->planes[0].aux_usage == ISL_AUX_USAGE_NONE)) { att_state->fast_clear = false; } if (att_state->fast_clear) { memcpy(fast_clear_color->u32, att_state->clear_value.color.uint32, sizeof(fast_clear_color->u32)); } } else { att_state->fast_clear = false; } } static bool need_input_attachment_state(const struct anv_render_pass_attachment *att) { if (!(att->usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) return false; /* We only allocate input attachment states for color surfaces. Compression * is not yet enabled for depth textures and stencil doesn't allow * compression so we can just use the texture surface state from the view. */ return vk_format_is_color(att->format); } /* Transitions a HiZ-enabled depth buffer from one layout to another. Unless * the initial layout is undefined, the HiZ buffer and depth buffer will * represent the same data at the end of this operation. */ static void transition_depth_buffer(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, VkImageLayout initial_layout, VkImageLayout final_layout) { assert(image); /* A transition is a no-op if HiZ is not enabled, or if the initial and * final layouts are equal. * * The undefined layout indicates that the user doesn't care about the data * that's currently in the buffer. Therefore, a data-preserving resolve * operation is not needed. */ if (image->planes[0].aux_usage != ISL_AUX_USAGE_HIZ || initial_layout == final_layout) return; const bool hiz_enabled = ISL_AUX_USAGE_HIZ == anv_layout_to_aux_usage(&cmd_buffer->device->info, image, VK_IMAGE_ASPECT_DEPTH_BIT, initial_layout); const bool enable_hiz = ISL_AUX_USAGE_HIZ == anv_layout_to_aux_usage(&cmd_buffer->device->info, image, VK_IMAGE_ASPECT_DEPTH_BIT, final_layout); enum blorp_hiz_op hiz_op; if (hiz_enabled && !enable_hiz) { hiz_op = BLORP_HIZ_OP_DEPTH_RESOLVE; } else if (!hiz_enabled && enable_hiz) { hiz_op = BLORP_HIZ_OP_HIZ_RESOLVE; } else { assert(hiz_enabled == enable_hiz); /* If the same buffer will be used, no resolves are necessary. */ hiz_op = BLORP_HIZ_OP_NONE; } if (hiz_op != BLORP_HIZ_OP_NONE) anv_gen8_hiz_op_resolve(cmd_buffer, image, hiz_op); } #define MI_PREDICATE_SRC0 0x2400 #define MI_PREDICATE_SRC1 0x2408 /* Manages the state of an color image subresource to ensure resolves are * performed properly. */ static void genX(set_image_needs_resolve)(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, VkImageAspectFlagBits aspect, unsigned level, bool needs_resolve) { assert(cmd_buffer && image); assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); assert(level < anv_image_aux_levels(image, aspect)); /* The HW docs say that there is no way to guarantee the completion of * the following command. We use it nevertheless because it shows no * issues in testing is currently being used in the GL driver. */ anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdi) { sdi.Address = anv_image_get_needs_resolve_addr(cmd_buffer->device, image, aspect, level); sdi.ImmediateData = needs_resolve; } } static void genX(load_needs_resolve_predicate)(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, VkImageAspectFlagBits aspect, unsigned level) { assert(cmd_buffer && image); assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); assert(level < anv_image_aux_levels(image, aspect)); const struct anv_address resolve_flag_addr = anv_image_get_needs_resolve_addr(cmd_buffer->device, image, aspect, level); /* Make the pending predicated resolve a no-op if one is not needed. * predicate = do_resolve = resolve_flag != 0; */ emit_lri(&cmd_buffer->batch, MI_PREDICATE_SRC1 , 0); emit_lri(&cmd_buffer->batch, MI_PREDICATE_SRC1 + 4, 0); emit_lri(&cmd_buffer->batch, MI_PREDICATE_SRC0 , 0); emit_lrm(&cmd_buffer->batch, MI_PREDICATE_SRC0 + 4, resolve_flag_addr.bo, resolve_flag_addr.offset); anv_batch_emit(&cmd_buffer->batch, GENX(MI_PREDICATE), mip) { mip.LoadOperation = LOAD_LOADINV; mip.CombineOperation = COMBINE_SET; mip.CompareOperation = COMPARE_SRCS_EQUAL; } } static void init_fast_clear_state_entry(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, VkImageAspectFlagBits aspect, unsigned level) { assert(cmd_buffer && image); assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); assert(level < anv_image_aux_levels(image, aspect)); uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); enum isl_aux_usage aux_usage = image->planes[plane].aux_usage; /* The resolve flag should updated to signify that fast-clear/compression * data needs to be removed when leaving the undefined layout. Such data * may need to be removed if it would cause accesses to the color buffer * to return incorrect data. The fast clear data in CCS_D buffers should * be removed because CCS_D isn't enabled all the time. */ genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level, aux_usage == ISL_AUX_USAGE_NONE); /* The fast clear value dword(s) will be copied into a surface state object. * Ensure that the restrictions of the fields in the dword(s) are followed. * * CCS buffers on SKL+ can have any value set for the clear colors. */ if (image->samples == 1 && GEN_GEN >= 9) return; /* Other combinations of auxiliary buffers and platforms require specific * values in the clear value dword(s). */ struct anv_address addr = anv_image_get_clear_color_addr(cmd_buffer->device, image, aspect, level); unsigned i = 0; for (; i < cmd_buffer->device->isl_dev.ss.clear_value_size; i += 4) { anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdi) { sdi.Address = addr; if (GEN_GEN >= 9) { /* MCS buffers on SKL+ can only have 1/0 clear colors. */ assert(aux_usage == ISL_AUX_USAGE_MCS); sdi.ImmediateData = 0; } else if (GEN_VERSIONx10 >= 75) { /* Pre-SKL, the dword containing the clear values also contains * other fields, so we need to initialize those fields to match the * values that would be in a color attachment. */ assert(i == 0); sdi.ImmediateData = ISL_CHANNEL_SELECT_RED << 25 | ISL_CHANNEL_SELECT_GREEN << 22 | ISL_CHANNEL_SELECT_BLUE << 19 | ISL_CHANNEL_SELECT_ALPHA << 16; } else if (GEN_VERSIONx10 == 70) { /* On IVB, the dword containing the clear values also contains * other fields that must be zero or can be zero. */ assert(i == 0); sdi.ImmediateData = 0; } } addr.offset += 4; } } /* Copy the fast-clear value dword(s) between a surface state object and an * image's fast clear state buffer. */ static void genX(copy_fast_clear_dwords)(struct anv_cmd_buffer *cmd_buffer, struct anv_state surface_state, const struct anv_image *image, VkImageAspectFlagBits aspect, unsigned level, bool copy_from_surface_state) { assert(cmd_buffer && image); assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); assert(level < anv_image_aux_levels(image, aspect)); struct anv_bo *ss_bo = &cmd_buffer->device->surface_state_pool.block_pool.bo; uint32_t ss_clear_offset = surface_state.offset + cmd_buffer->device->isl_dev.ss.clear_value_offset; const struct anv_address entry_addr = anv_image_get_clear_color_addr(cmd_buffer->device, image, aspect, level); unsigned copy_size = cmd_buffer->device->isl_dev.ss.clear_value_size; if (copy_from_surface_state) { genX(cmd_buffer_mi_memcpy)(cmd_buffer, entry_addr.bo, entry_addr.offset, ss_bo, ss_clear_offset, copy_size); } else { genX(cmd_buffer_mi_memcpy)(cmd_buffer, ss_bo, ss_clear_offset, entry_addr.bo, entry_addr.offset, copy_size); /* Updating a surface state object may require that the state cache be * invalidated. From the SKL PRM, Shared Functions -> State -> State * Caching: * * Whenever the RENDER_SURFACE_STATE object in memory pointed to by * the Binding Table Pointer (BTP) and Binding Table Index (BTI) is * modified [...], the L1 state cache must be invalidated to ensure * the new surface or sampler state is fetched from system memory. * * In testing, SKL doesn't actually seem to need this, but HSW does. */ cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_STATE_CACHE_INVALIDATE_BIT; } } /** * @brief Transitions a color buffer from one layout to another. * * See section 6.1.1. Image Layout Transitions of the Vulkan 1.0.50 spec for * more information. * * @param level_count VK_REMAINING_MIP_LEVELS isn't supported. * @param layer_count VK_REMAINING_ARRAY_LAYERS isn't supported. For 3D images, * this represents the maximum layers to transition at each * specified miplevel. */ static void transition_color_buffer(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, VkImageAspectFlagBits aspect, const uint32_t base_level, uint32_t level_count, uint32_t base_layer, uint32_t layer_count, VkImageLayout initial_layout, VkImageLayout final_layout) { /* Validate the inputs. */ assert(cmd_buffer); assert(image && image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); /* These values aren't supported for simplicity's sake. */ assert(level_count != VK_REMAINING_MIP_LEVELS && layer_count != VK_REMAINING_ARRAY_LAYERS); /* Ensure the subresource range is valid. */ uint64_t last_level_num = base_level + level_count; const uint32_t max_depth = anv_minify(image->extent.depth, base_level); UNUSED const uint32_t image_layers = MAX2(image->array_size, max_depth); assert((uint64_t)base_layer + layer_count <= image_layers); assert(last_level_num <= image->levels); /* The spec disallows these final layouts. */ assert(final_layout != VK_IMAGE_LAYOUT_UNDEFINED && final_layout != VK_IMAGE_LAYOUT_PREINITIALIZED); /* No work is necessary if the layout stays the same or if this subresource * range lacks auxiliary data. */ if (initial_layout == final_layout) return; uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); if (image->planes[plane].shadow_surface.isl.size > 0 && final_layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { /* This surface is a linear compressed image with a tiled shadow surface * for texturing. The client is about to use it in READ_ONLY_OPTIMAL so * we need to ensure the shadow copy is up-to-date. */ assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT); assert(image->planes[plane].surface.isl.tiling == ISL_TILING_LINEAR); assert(image->planes[plane].shadow_surface.isl.tiling != ISL_TILING_LINEAR); assert(isl_format_is_compressed(image->planes[plane].surface.isl.format)); assert(plane == 0); anv_image_copy_to_shadow(cmd_buffer, image, base_level, level_count, base_layer, layer_count); } if (base_layer >= anv_image_aux_layers(image, aspect, base_level)) return; /* A transition of a 3D subresource works on all slices at a time. */ if (image->type == VK_IMAGE_TYPE_3D) { base_layer = 0; layer_count = anv_minify(image->extent.depth, base_level); } /* We're interested in the subresource range subset that has aux data. */ level_count = MIN2(level_count, anv_image_aux_levels(image, aspect) - base_level); layer_count = MIN2(layer_count, anv_image_aux_layers(image, aspect, base_level) - base_layer); last_level_num = base_level + level_count; /* Record whether or not the layout is undefined. Pre-initialized images * with auxiliary buffers have a non-linear layout and are thus undefined. */ assert(image->tiling == VK_IMAGE_TILING_OPTIMAL); const bool undef_layout = initial_layout == VK_IMAGE_LAYOUT_UNDEFINED || initial_layout == VK_IMAGE_LAYOUT_PREINITIALIZED; /* Do preparatory work before the resolve operation or return early if no * resolve is actually needed. */ if (undef_layout) { /* A subresource in the undefined layout may have been aliased and * populated with any arrangement of bits. Therefore, we must initialize * the related aux buffer and clear buffer entry with desirable values. * * Initialize the relevant clear buffer entries. */ for (unsigned level = base_level; level < last_level_num; level++) init_fast_clear_state_entry(cmd_buffer, image, aspect, level); /* Initialize the aux buffers to enable correct rendering. This operation * requires up to two steps: one to rid the aux buffer of data that may * cause GPU hangs, and another to ensure that writes done without aux * will be visible to reads done with aux. * * Having an aux buffer with invalid data is possible for CCS buffers * SKL+ and for MCS buffers with certain sample counts (2x and 8x). One * easy way to get to a valid state is to fast-clear the specified range. * * Even for MCS buffers that have sample counts that don't require * certain bits to be reserved (4x and 8x), we're unsure if the hardware * will be okay with the sample mappings given by the undefined buffer. * We don't have any data to show that this is a problem, but we want to * avoid causing difficult-to-debug problems. */ if ((GEN_GEN >= 9 && image->samples == 1) || image->samples > 1) { if (image->samples == 4 || image->samples == 16) { anv_perf_warn(cmd_buffer->device->instance, image, "Doing a potentially unnecessary fast-clear to " "define an MCS buffer."); } anv_image_fast_clear(cmd_buffer, image, aspect, base_level, level_count, base_layer, layer_count); } /* At this point, some elements of the CCS buffer may have the fast-clear * bit-arrangement. As the user writes to a subresource, we need to have * the associated CCS elements enter the ambiguated state. This enables * reads (implicit or explicit) to reflect the user-written data instead * of the clear color. The only time such elements will not change their * state as described above, is in a final layout that doesn't have CCS * enabled. In this case, we must force the associated CCS buffers of the * specified range to enter the ambiguated state in advance. */ if (image->samples == 1 && image->planes[plane].aux_usage != ISL_AUX_USAGE_CCS_E && final_layout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { /* The CCS_D buffer may not be enabled in the final layout. Continue * executing this function to perform a resolve. */ anv_perf_warn(cmd_buffer->device->instance, image, "Performing an additional resolve for CCS_D layout " "transition. Consider always leaving it on or " "performing an ambiguation pass."); } else { /* Writes in the final layout will be aware of the auxiliary buffer. * In addition, the clear buffer entries and the auxiliary buffers * have been populated with values that will result in correct * rendering. */ return; } } else if (initial_layout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { /* Resolves are only necessary if the subresource may contain blocks * fast-cleared to values unsupported in other layouts. This only occurs * if the initial layout is COLOR_ATTACHMENT_OPTIMAL. */ return; } else if (image->samples > 1) { /* MCS buffers don't need resolving. */ return; } /* Perform a resolve to synchronize data between the main and aux buffer. * Before we begin, we must satisfy the cache flushing requirement specified * in the Sky Lake PRM Vol. 7, "MCS Buffer for Render Target(s)": * * Any transition from any value in {Clear, Render, Resolve} to a * different value in {Clear, Render, Resolve} requires end of pipe * synchronization. * * We perform a flush of the write cache before and after the clear and * resolve operations to meet this requirement. * * Unlike other drawing, fast clear operations are not properly * synchronized. The first PIPE_CONTROL here likely ensures that the * contents of the previous render or clear hit the render target before we * resolve and the second likely ensures that the resolve is complete before * we do any more rendering or clearing. */ cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT; for (uint32_t level = base_level; level < last_level_num; level++) { /* The number of layers changes at each 3D miplevel. */ if (image->type == VK_IMAGE_TYPE_3D) { layer_count = MIN2(layer_count, anv_image_aux_layers(image, aspect, level)); } genX(load_needs_resolve_predicate)(cmd_buffer, image, aspect, level); anv_ccs_resolve(cmd_buffer, image, aspect, level, base_layer, layer_count, image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E ? BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL : BLORP_FAST_CLEAR_OP_RESOLVE_FULL); genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level, false); } cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT; } /** * Setup anv_cmd_state::attachments for vkCmdBeginRenderPass. */ static VkResult genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, struct anv_render_pass *pass, const VkRenderPassBeginInfo *begin) { const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev; struct anv_cmd_state *state = &cmd_buffer->state; vk_free(&cmd_buffer->pool->alloc, state->attachments); if (pass->attachment_count > 0) { state->attachments = vk_alloc(&cmd_buffer->pool->alloc, pass->attachment_count * sizeof(state->attachments[0]), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (state->attachments == NULL) { /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ return anv_batch_set_error(&cmd_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY); } } else { state->attachments = NULL; } /* Reserve one for the NULL state. */ unsigned num_states = 1; for (uint32_t i = 0; i < pass->attachment_count; ++i) { if (vk_format_is_color(pass->attachments[i].format)) num_states++; if (need_input_attachment_state(&pass->attachments[i])) num_states++; } const uint32_t ss_stride = align_u32(isl_dev->ss.size, isl_dev->ss.align); state->render_pass_states = anv_state_stream_alloc(&cmd_buffer->surface_state_stream, num_states * ss_stride, isl_dev->ss.align); struct anv_state next_state = state->render_pass_states; next_state.alloc_size = isl_dev->ss.size; state->null_surface_state = next_state; next_state.offset += ss_stride; next_state.map += ss_stride; for (uint32_t i = 0; i < pass->attachment_count; ++i) { if (vk_format_is_color(pass->attachments[i].format)) { state->attachments[i].color.state = next_state; next_state.offset += ss_stride; next_state.map += ss_stride; } if (need_input_attachment_state(&pass->attachments[i])) { state->attachments[i].input.state = next_state; next_state.offset += ss_stride; next_state.map += ss_stride; } } assert(next_state.offset == state->render_pass_states.offset + state->render_pass_states.alloc_size); if (begin) { ANV_FROM_HANDLE(anv_framebuffer, framebuffer, begin->framebuffer); assert(pass->attachment_count == framebuffer->attachment_count); isl_null_fill_state(isl_dev, state->null_surface_state.map, isl_extent3d(framebuffer->width, framebuffer->height, framebuffer->layers)); for (uint32_t i = 0; i < pass->attachment_count; ++i) { struct anv_render_pass_attachment *att = &pass->attachments[i]; VkImageAspectFlags att_aspects = vk_format_aspects(att->format); VkImageAspectFlags clear_aspects = 0; if (att_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) { /* color attachment */ if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { clear_aspects |= VK_IMAGE_ASPECT_COLOR_BIT; } } else { /* depthstencil attachment */ if ((att_aspects & VK_IMAGE_ASPECT_DEPTH_BIT) && att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { clear_aspects |= VK_IMAGE_ASPECT_DEPTH_BIT; } if ((att_aspects & VK_IMAGE_ASPECT_STENCIL_BIT) && att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { clear_aspects |= VK_IMAGE_ASPECT_STENCIL_BIT; } } state->attachments[i].current_layout = att->initial_layout; state->attachments[i].pending_clear_aspects = clear_aspects; if (clear_aspects) state->attachments[i].clear_value = begin->pClearValues[i]; struct anv_image_view *iview = framebuffer->attachments[i]; anv_assert(iview->vk_format == att->format); union isl_color_value clear_color = { .u32 = { 0, } }; if (att_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) { anv_assert(iview->n_planes == 1); assert(att_aspects == VK_IMAGE_ASPECT_COLOR_BIT); color_attachment_compute_aux_usage(cmd_buffer->device, state, i, begin->renderArea, &clear_color); anv_image_fill_surface_state(cmd_buffer->device, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, &iview->planes[0].isl, ISL_SURF_USAGE_RENDER_TARGET_BIT, state->attachments[i].aux_usage, &clear_color, 0, &state->attachments[i].color, NULL); add_image_view_relocs(cmd_buffer, iview, 0, state->attachments[i].color); } else { /* This field will be initialized after the first subpass * transition. */ state->attachments[i].aux_usage = ISL_AUX_USAGE_NONE; state->attachments[i].input_aux_usage = ISL_AUX_USAGE_NONE; } if (need_input_attachment_state(&pass->attachments[i])) { anv_image_fill_surface_state(cmd_buffer->device, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, &iview->planes[0].isl, ISL_SURF_USAGE_TEXTURE_BIT, state->attachments[i].input_aux_usage, &clear_color, 0, &state->attachments[i].input, NULL); add_image_view_relocs(cmd_buffer, iview, 0, state->attachments[i].input); } } } return VK_SUCCESS; } VkResult genX(BeginCommandBuffer)( VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); /* If this is the first vkBeginCommandBuffer, we must *initialize* the * command buffer's state. Otherwise, we must *reset* its state. In both * cases we reset it. * * From the Vulkan 1.0 spec: * * If a command buffer is in the executable state and the command buffer * was allocated from a command pool with the * VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT flag set, then * vkBeginCommandBuffer implicitly resets the command buffer, behaving * as if vkResetCommandBuffer had been called with * VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT not set. It then puts * the command buffer in the recording state. */ anv_cmd_buffer_reset(cmd_buffer); cmd_buffer->usage_flags = pBeginInfo->flags; assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY || !(cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT)); genX(cmd_buffer_emit_state_base_address)(cmd_buffer); /* We sometimes store vertex data in the dynamic state buffer for blorp * operations and our dynamic state stream may re-use data from previous * command buffers. In order to prevent stale cache data, we flush the VF * cache. We could do this on every blorp call but that's not really * needed as all of the data will get written by the CPU prior to the GPU * executing anything. The chances are fairly high that they will use * blorp at least once per primary command buffer so it shouldn't be * wasted. */ if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY) cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_VF_CACHE_INVALIDATE_BIT; /* We send an "Indirect State Pointers Disable" packet at * EndCommandBuffer, so all push contant packets are ignored during a * context restore. Documentation says after that command, we need to * emit push constants again before any rendering operation. So we * flag them dirty here to make sure they get emitted. */ if (GEN_GEN == 10) cmd_buffer->state.push_constants_dirty |= VK_SHADER_STAGE_ALL_GRAPHICS; VkResult result = VK_SUCCESS; if (cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { assert(pBeginInfo->pInheritanceInfo); cmd_buffer->state.pass = anv_render_pass_from_handle(pBeginInfo->pInheritanceInfo->renderPass); cmd_buffer->state.subpass = &cmd_buffer->state.pass->subpasses[pBeginInfo->pInheritanceInfo->subpass]; /* This is optional in the inheritance info. */ cmd_buffer->state.framebuffer = anv_framebuffer_from_handle(pBeginInfo->pInheritanceInfo->framebuffer); result = genX(cmd_buffer_setup_attachments)(cmd_buffer, cmd_buffer->state.pass, NULL); /* Record that HiZ is enabled if we can. */ if (cmd_buffer->state.framebuffer) { const struct anv_image_view * const iview = anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); if (iview) { VkImageLayout layout = cmd_buffer->state.subpass->depth_stencil_attachment.layout; enum isl_aux_usage aux_usage = anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image, VK_IMAGE_ASPECT_DEPTH_BIT, layout); cmd_buffer->state.hiz_enabled = aux_usage == ISL_AUX_USAGE_HIZ; } } cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS; } return result; } /* From the PRM, Volume 2a: * * "Indirect State Pointers Disable * * At the completion of the post-sync operation associated with this pipe * control packet, the indirect state pointers in the hardware are * considered invalid; the indirect pointers are not saved in the context. * If any new indirect state commands are executed in the command stream * while the pipe control is pending, the new indirect state commands are * preserved. * * [DevIVB+]: Using Invalidate State Pointer (ISP) only inhibits context * restoring of Push Constant (3DSTATE_CONSTANT_*) commands. Push Constant * commands are only considered as Indirect State Pointers. Once ISP is * issued in a context, SW must initialize by programming push constant * commands for all the shaders (at least to zero length) before attempting * any rendering operation for the same context." * * 3DSTATE_CONSTANT_* packets are restored during a context restore, * even though they point to a BO that has been already unreferenced at * the end of the previous batch buffer. This has been fine so far since * we are protected by these scratch page (every address not covered by * a BO should be pointing to the scratch page). But on CNL, it is * causing a GPU hang during context restore at the 3DSTATE_CONSTANT_* * instruction. * * The flag "Indirect State Pointers Disable" in PIPE_CONTROL tells the * hardware to ignore previous 3DSTATE_CONSTANT_* packets during a * context restore, so the mentioned hang doesn't happen. However, * software must program push constant commands for all stages prior to * rendering anything. So we flag them dirty in BeginCommandBuffer. */ static void emit_isp_disable(struct anv_cmd_buffer *cmd_buffer) { anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.IndirectStatePointersDisable = true; pc.CommandStreamerStallEnable = true; } } VkResult genX(EndCommandBuffer)( VkCommandBuffer commandBuffer) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); if (anv_batch_has_error(&cmd_buffer->batch)) return cmd_buffer->batch.status; /* We want every command buffer to start with the PMA fix in a known state, * so we disable it at the end of the command buffer. */ genX(cmd_buffer_enable_pma_fix)(cmd_buffer, false); genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer); if (GEN_GEN == 10) emit_isp_disable(cmd_buffer); anv_cmd_buffer_end_batch_buffer(cmd_buffer); return VK_SUCCESS; } void genX(CmdExecuteCommands)( VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCmdBuffers) { ANV_FROM_HANDLE(anv_cmd_buffer, primary, commandBuffer); assert(primary->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); if (anv_batch_has_error(&primary->batch)) return; /* The secondary command buffers will assume that the PMA fix is disabled * when they begin executing. Make sure this is true. */ genX(cmd_buffer_enable_pma_fix)(primary, false); /* The secondary command buffer doesn't know which textures etc. have been * flushed prior to their execution. Apply those flushes now. */ genX(cmd_buffer_apply_pipe_flushes)(primary); for (uint32_t i = 0; i < commandBufferCount; i++) { ANV_FROM_HANDLE(anv_cmd_buffer, secondary, pCmdBuffers[i]); assert(secondary->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY); assert(!anv_batch_has_error(&secondary->batch)); if (secondary->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { /* If we're continuing a render pass from the primary, we need to * copy the surface states for the current subpass into the storage * we allocated for them in BeginCommandBuffer. */ struct anv_bo *ss_bo = &primary->device->surface_state_pool.block_pool.bo; struct anv_state src_state = primary->state.render_pass_states; struct anv_state dst_state = secondary->state.render_pass_states; assert(src_state.alloc_size == dst_state.alloc_size); genX(cmd_buffer_so_memcpy)(primary, ss_bo, dst_state.offset, ss_bo, src_state.offset, src_state.alloc_size); } anv_cmd_buffer_add_secondary(primary, secondary); } /* The secondary may have selected a different pipeline (3D or compute) and * may have changed the current L3$ configuration. Reset our tracking * variables to invalid values to ensure that we re-emit these in the case * where we do any draws or compute dispatches from the primary after the * secondary has returned. */ primary->state.current_pipeline = UINT32_MAX; primary->state.current_l3_config = NULL; /* Each of the secondary command buffers will use its own state base * address. We need to re-emit state base address for the primary after * all of the secondaries are done. * * TODO: Maybe we want to make this a dirty bit to avoid extra state base * address calls? */ genX(cmd_buffer_emit_state_base_address)(primary); } #define IVB_L3SQCREG1_SQGHPCI_DEFAULT 0x00730000 #define VLV_L3SQCREG1_SQGHPCI_DEFAULT 0x00d30000 #define HSW_L3SQCREG1_SQGHPCI_DEFAULT 0x00610000 /** * Program the hardware to use the specified L3 configuration. */ void genX(cmd_buffer_config_l3)(struct anv_cmd_buffer *cmd_buffer, const struct gen_l3_config *cfg) { assert(cfg); if (cfg == cmd_buffer->state.current_l3_config) return; if (unlikely(INTEL_DEBUG & DEBUG_L3)) { intel_logd("L3 config transition: "); gen_dump_l3_config(cfg, stderr); } const bool has_slm = cfg->n[GEN_L3P_SLM]; /* According to the hardware docs, the L3 partitioning can only be changed * while the pipeline is completely drained and the caches are flushed, * which involves a first PIPE_CONTROL flush which stalls the pipeline... */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.DCFlushEnable = true; pc.PostSyncOperation = NoWrite; pc.CommandStreamerStallEnable = true; } /* ...followed by a second pipelined PIPE_CONTROL that initiates * invalidation of the relevant caches. Note that because RO invalidation * happens at the top of the pipeline (i.e. right away as the PIPE_CONTROL * command is processed by the CS) we cannot combine it with the previous * stalling flush as the hardware documentation suggests, because that * would cause the CS to stall on previous rendering *after* RO * invalidation and wouldn't prevent the RO caches from being polluted by * concurrent rendering before the stall completes. This intentionally * doesn't implement the SKL+ hardware workaround suggesting to enable CS * stall on PIPE_CONTROLs with the texture cache invalidation bit set for * GPGPU workloads because the previous and subsequent PIPE_CONTROLs * already guarantee that there is no concurrent GPGPU kernel execution * (see SKL HSD 2132585). */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.TextureCacheInvalidationEnable = true; pc.ConstantCacheInvalidationEnable = true; pc.InstructionCacheInvalidateEnable = true; pc.StateCacheInvalidationEnable = true; pc.PostSyncOperation = NoWrite; } /* Now send a third stalling flush to make sure that invalidation is * complete when the L3 configuration registers are modified. */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.DCFlushEnable = true; pc.PostSyncOperation = NoWrite; pc.CommandStreamerStallEnable = true; } #if GEN_GEN >= 8 assert(!cfg->n[GEN_L3P_IS] && !cfg->n[GEN_L3P_C] && !cfg->n[GEN_L3P_T]); uint32_t l3cr; anv_pack_struct(&l3cr, GENX(L3CNTLREG), .SLMEnable = has_slm, .URBAllocation = cfg->n[GEN_L3P_URB], .ROAllocation = cfg->n[GEN_L3P_RO], .DCAllocation = cfg->n[GEN_L3P_DC], .AllAllocation = cfg->n[GEN_L3P_ALL]); /* Set up the L3 partitioning. */ emit_lri(&cmd_buffer->batch, GENX(L3CNTLREG_num), l3cr); #else const bool has_dc = cfg->n[GEN_L3P_DC] || cfg->n[GEN_L3P_ALL]; const bool has_is = cfg->n[GEN_L3P_IS] || cfg->n[GEN_L3P_RO] || cfg->n[GEN_L3P_ALL]; const bool has_c = cfg->n[GEN_L3P_C] || cfg->n[GEN_L3P_RO] || cfg->n[GEN_L3P_ALL]; const bool has_t = cfg->n[GEN_L3P_T] || cfg->n[GEN_L3P_RO] || cfg->n[GEN_L3P_ALL]; assert(!cfg->n[GEN_L3P_ALL]); /* When enabled SLM only uses a portion of the L3 on half of the banks, * the matching space on the remaining banks has to be allocated to a * client (URB for all validated configurations) set to the * lower-bandwidth 2-bank address hashing mode. */ const struct gen_device_info *devinfo = &cmd_buffer->device->info; const bool urb_low_bw = has_slm && !devinfo->is_baytrail; assert(!urb_low_bw || cfg->n[GEN_L3P_URB] == cfg->n[GEN_L3P_SLM]); /* Minimum number of ways that can be allocated to the URB. */ MAYBE_UNUSED const unsigned n0_urb = devinfo->is_baytrail ? 32 : 0; assert(cfg->n[GEN_L3P_URB] >= n0_urb); uint32_t l3sqcr1, l3cr2, l3cr3; anv_pack_struct(&l3sqcr1, GENX(L3SQCREG1), .ConvertDC_UC = !has_dc, .ConvertIS_UC = !has_is, .ConvertC_UC = !has_c, .ConvertT_UC = !has_t); l3sqcr1 |= GEN_IS_HASWELL ? HSW_L3SQCREG1_SQGHPCI_DEFAULT : devinfo->is_baytrail ? VLV_L3SQCREG1_SQGHPCI_DEFAULT : IVB_L3SQCREG1_SQGHPCI_DEFAULT; anv_pack_struct(&l3cr2, GENX(L3CNTLREG2), .SLMEnable = has_slm, .URBLowBandwidth = urb_low_bw, .URBAllocation = cfg->n[GEN_L3P_URB] - n0_urb, #if !GEN_IS_HASWELL .ALLAllocation = cfg->n[GEN_L3P_ALL], #endif .ROAllocation = cfg->n[GEN_L3P_RO], .DCAllocation = cfg->n[GEN_L3P_DC]); anv_pack_struct(&l3cr3, GENX(L3CNTLREG3), .ISAllocation = cfg->n[GEN_L3P_IS], .ISLowBandwidth = 0, .CAllocation = cfg->n[GEN_L3P_C], .CLowBandwidth = 0, .TAllocation = cfg->n[GEN_L3P_T], .TLowBandwidth = 0); /* Set up the L3 partitioning. */ emit_lri(&cmd_buffer->batch, GENX(L3SQCREG1_num), l3sqcr1); emit_lri(&cmd_buffer->batch, GENX(L3CNTLREG2_num), l3cr2); emit_lri(&cmd_buffer->batch, GENX(L3CNTLREG3_num), l3cr3); #if GEN_IS_HASWELL if (cmd_buffer->device->instance->physicalDevice.cmd_parser_version >= 4) { /* Enable L3 atomics on HSW if we have a DC partition, otherwise keep * them disabled to avoid crashing the system hard. */ uint32_t scratch1, chicken3; anv_pack_struct(&scratch1, GENX(SCRATCH1), .L3AtomicDisable = !has_dc); anv_pack_struct(&chicken3, GENX(CHICKEN3), .L3AtomicDisableMask = true, .L3AtomicDisable = !has_dc); emit_lri(&cmd_buffer->batch, GENX(SCRATCH1_num), scratch1); emit_lri(&cmd_buffer->batch, GENX(CHICKEN3_num), chicken3); } #endif #endif cmd_buffer->state.current_l3_config = cfg; } void genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer) { enum anv_pipe_bits bits = cmd_buffer->state.pending_pipe_bits; /* Flushes are pipelined while invalidations are handled immediately. * Therefore, if we're flushing anything then we need to schedule a stall * before any invalidations can happen. */ if (bits & ANV_PIPE_FLUSH_BITS) bits |= ANV_PIPE_NEEDS_CS_STALL_BIT; /* If we're going to do an invalidate and we have a pending CS stall that * has yet to be resolved, we do the CS stall now. */ if ((bits & ANV_PIPE_INVALIDATE_BITS) && (bits & ANV_PIPE_NEEDS_CS_STALL_BIT)) { bits |= ANV_PIPE_CS_STALL_BIT; bits &= ~ANV_PIPE_NEEDS_CS_STALL_BIT; } if (bits & (ANV_PIPE_FLUSH_BITS | ANV_PIPE_CS_STALL_BIT)) { anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pipe) { pipe.DepthCacheFlushEnable = bits & ANV_PIPE_DEPTH_CACHE_FLUSH_BIT; pipe.DCFlushEnable = bits & ANV_PIPE_DATA_CACHE_FLUSH_BIT; pipe.RenderTargetCacheFlushEnable = bits & ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT; pipe.DepthStallEnable = bits & ANV_PIPE_DEPTH_STALL_BIT; pipe.CommandStreamerStallEnable = bits & ANV_PIPE_CS_STALL_BIT; pipe.StallAtPixelScoreboard = bits & ANV_PIPE_STALL_AT_SCOREBOARD_BIT; /* * According to the Broadwell documentation, any PIPE_CONTROL with the * "Command Streamer Stall" bit set must also have another bit set, * with five different options: * * - Render Target Cache Flush * - Depth Cache Flush * - Stall at Pixel Scoreboard * - Post-Sync Operation * - Depth Stall * - DC Flush Enable * * I chose "Stall at Pixel Scoreboard" since that's what we use in * mesa and it seems to work fine. The choice is fairly arbitrary. */ if ((bits & ANV_PIPE_CS_STALL_BIT) && !(bits & (ANV_PIPE_FLUSH_BITS | ANV_PIPE_DEPTH_STALL_BIT | ANV_PIPE_STALL_AT_SCOREBOARD_BIT))) pipe.StallAtPixelScoreboard = true; } bits &= ~(ANV_PIPE_FLUSH_BITS | ANV_PIPE_CS_STALL_BIT); } if (bits & ANV_PIPE_INVALIDATE_BITS) { anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pipe) { pipe.StateCacheInvalidationEnable = bits & ANV_PIPE_STATE_CACHE_INVALIDATE_BIT; pipe.ConstantCacheInvalidationEnable = bits & ANV_PIPE_CONSTANT_CACHE_INVALIDATE_BIT; pipe.VFCacheInvalidationEnable = bits & ANV_PIPE_VF_CACHE_INVALIDATE_BIT; pipe.TextureCacheInvalidationEnable = bits & ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT; pipe.InstructionCacheInvalidateEnable = bits & ANV_PIPE_INSTRUCTION_CACHE_INVALIDATE_BIT; } bits &= ~ANV_PIPE_INVALIDATE_BITS; } cmd_buffer->state.pending_pipe_bits = bits; } void genX(CmdPipelineBarrier)( VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, VkBool32 byRegion, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); /* XXX: Right now, we're really dumb and just flush whatever categories * the app asks for. One of these days we may make this a bit better * but right now that's all the hardware allows for in most areas. */ VkAccessFlags src_flags = 0; VkAccessFlags dst_flags = 0; for (uint32_t i = 0; i < memoryBarrierCount; i++) { src_flags |= pMemoryBarriers[i].srcAccessMask; dst_flags |= pMemoryBarriers[i].dstAccessMask; } for (uint32_t i = 0; i < bufferMemoryBarrierCount; i++) { src_flags |= pBufferMemoryBarriers[i].srcAccessMask; dst_flags |= pBufferMemoryBarriers[i].dstAccessMask; } for (uint32_t i = 0; i < imageMemoryBarrierCount; i++) { src_flags |= pImageMemoryBarriers[i].srcAccessMask; dst_flags |= pImageMemoryBarriers[i].dstAccessMask; ANV_FROM_HANDLE(anv_image, image, pImageMemoryBarriers[i].image); const VkImageSubresourceRange *range = &pImageMemoryBarriers[i].subresourceRange; if (range->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) { transition_depth_buffer(cmd_buffer, image, pImageMemoryBarriers[i].oldLayout, pImageMemoryBarriers[i].newLayout); } else if (range->aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) { VkImageAspectFlags color_aspects = anv_image_expand_aspects(image, range->aspectMask); uint32_t aspect_bit; anv_foreach_image_aspect_bit(aspect_bit, image, color_aspects) { transition_color_buffer(cmd_buffer, image, 1UL << aspect_bit, range->baseMipLevel, anv_get_levelCount(image, range), range->baseArrayLayer, anv_get_layerCount(image, range), pImageMemoryBarriers[i].oldLayout, pImageMemoryBarriers[i].newLayout); } } } cmd_buffer->state.pending_pipe_bits |= anv_pipe_flush_bits_for_access_flags(src_flags) | anv_pipe_invalidate_bits_for_access_flags(dst_flags); } static void cmd_buffer_alloc_push_constants(struct anv_cmd_buffer *cmd_buffer) { VkShaderStageFlags stages = cmd_buffer->state.gfx.base.pipeline->active_stages; /* In order to avoid thrash, we assume that vertex and fragment stages * always exist. In the rare case where one is missing *and* the other * uses push concstants, this may be suboptimal. However, avoiding stalls * seems more important. */ stages |= VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_VERTEX_BIT; if (stages == cmd_buffer->state.push_constant_stages) return; #if GEN_GEN >= 8 const unsigned push_constant_kb = 32; #elif GEN_IS_HASWELL const unsigned push_constant_kb = cmd_buffer->device->info.gt == 3 ? 32 : 16; #else const unsigned push_constant_kb = 16; #endif const unsigned num_stages = _mesa_bitcount(stages & VK_SHADER_STAGE_ALL_GRAPHICS); unsigned size_per_stage = push_constant_kb / num_stages; /* Broadwell+ and Haswell gt3 require that the push constant sizes be in * units of 2KB. Incidentally, these are the same platforms that have * 32KB worth of push constant space. */ if (push_constant_kb == 32) size_per_stage &= ~1u; uint32_t kb_used = 0; for (int i = MESA_SHADER_VERTEX; i < MESA_SHADER_FRAGMENT; i++) { unsigned push_size = (stages & (1 << i)) ? size_per_stage : 0; anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_VS), alloc) { alloc._3DCommandSubOpcode = 18 + i; alloc.ConstantBufferOffset = (push_size > 0) ? kb_used : 0; alloc.ConstantBufferSize = push_size; } kb_used += push_size; } anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_PS), alloc) { alloc.ConstantBufferOffset = kb_used; alloc.ConstantBufferSize = push_constant_kb - kb_used; } cmd_buffer->state.push_constant_stages = stages; /* From the BDW PRM for 3DSTATE_PUSH_CONSTANT_ALLOC_VS: * * "The 3DSTATE_CONSTANT_VS must be reprogrammed prior to * the next 3DPRIMITIVE command after programming the * 3DSTATE_PUSH_CONSTANT_ALLOC_VS" * * Since 3DSTATE_PUSH_CONSTANT_ALLOC_VS is programmed as part of * pipeline setup, we need to dirty push constants. */ cmd_buffer->state.push_constants_dirty |= VK_SHADER_STAGE_ALL_GRAPHICS; } static const struct anv_descriptor * anv_descriptor_for_binding(const struct anv_cmd_pipeline_state *pipe_state, const struct anv_pipeline_binding *binding) { assert(binding->set < MAX_SETS); const struct anv_descriptor_set *set = pipe_state->descriptors[binding->set]; const uint32_t offset = set->layout->binding[binding->binding].descriptor_index; return &set->descriptors[offset + binding->index]; } static uint32_t dynamic_offset_for_binding(const struct anv_cmd_pipeline_state *pipe_state, const struct anv_pipeline *pipeline, const struct anv_pipeline_binding *binding) { assert(binding->set < MAX_SETS); const struct anv_descriptor_set *set = pipe_state->descriptors[binding->set]; uint32_t dynamic_offset_idx = pipeline->layout->set[binding->set].dynamic_offset_start + set->layout->binding[binding->binding].dynamic_offset_index + binding->index; return pipe_state->dynamic_offsets[dynamic_offset_idx]; } static VkResult emit_binding_table(struct anv_cmd_buffer *cmd_buffer, gl_shader_stage stage, struct anv_state *bt_state) { struct anv_subpass *subpass = cmd_buffer->state.subpass; struct anv_cmd_pipeline_state *pipe_state; struct anv_pipeline *pipeline; uint32_t bias, state_offset; switch (stage) { case MESA_SHADER_COMPUTE: pipe_state = &cmd_buffer->state.compute.base; bias = 1; break; default: pipe_state = &cmd_buffer->state.gfx.base; bias = 0; break; } pipeline = pipe_state->pipeline; if (!anv_pipeline_has_stage(pipeline, stage)) { *bt_state = (struct anv_state) { 0, }; return VK_SUCCESS; } struct anv_pipeline_bind_map *map = &pipeline->shaders[stage]->bind_map; if (bias + map->surface_count == 0) { *bt_state = (struct anv_state) { 0, }; return VK_SUCCESS; } *bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer, bias + map->surface_count, &state_offset); uint32_t *bt_map = bt_state->map; if (bt_state->map == NULL) return VK_ERROR_OUT_OF_DEVICE_MEMORY; if (stage == MESA_SHADER_COMPUTE && get_cs_prog_data(pipeline)->uses_num_work_groups) { struct anv_bo *bo = cmd_buffer->state.compute.num_workgroups.bo; uint32_t bo_offset = cmd_buffer->state.compute.num_workgroups.offset; struct anv_state surface_state; surface_state = anv_cmd_buffer_alloc_surface_state(cmd_buffer); const enum isl_format format = anv_isl_format_for_descriptor_type(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); anv_fill_buffer_surface_state(cmd_buffer->device, surface_state, format, bo_offset, 12, 1); bt_map[0] = surface_state.offset + state_offset; add_surface_state_reloc(cmd_buffer, surface_state, bo, bo_offset); } if (map->surface_count == 0) goto out; if (map->image_count > 0) { VkResult result = anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, stage, images); if (result != VK_SUCCESS) return result; cmd_buffer->state.push_constants_dirty |= 1 << stage; } uint32_t image = 0; for (uint32_t s = 0; s < map->surface_count; s++) { struct anv_pipeline_binding *binding = &map->surface_to_descriptor[s]; struct anv_state surface_state; if (binding->set == ANV_DESCRIPTOR_SET_COLOR_ATTACHMENTS) { /* Color attachment binding */ assert(stage == MESA_SHADER_FRAGMENT); assert(binding->binding == 0); if (binding->index < subpass->color_count) { const unsigned att = subpass->color_attachments[binding->index].attachment; /* From the Vulkan 1.0.46 spec: * * "If any color or depth/stencil attachments are * VK_ATTACHMENT_UNUSED, then no writes occur for those * attachments." */ if (att == VK_ATTACHMENT_UNUSED) { surface_state = cmd_buffer->state.null_surface_state; } else { surface_state = cmd_buffer->state.attachments[att].color.state; } } else { surface_state = cmd_buffer->state.null_surface_state; } bt_map[bias + s] = surface_state.offset + state_offset; continue; } const struct anv_descriptor *desc = anv_descriptor_for_binding(pipe_state, binding); switch (desc->type) { case VK_DESCRIPTOR_TYPE_SAMPLER: /* Nothing for us to do here */ continue; case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: { struct anv_surface_state sstate = (desc->layout == VK_IMAGE_LAYOUT_GENERAL) ? desc->image_view->planes[binding->plane].general_sampler_surface_state : desc->image_view->planes[binding->plane].optimal_sampler_surface_state; surface_state = sstate.state; assert(surface_state.alloc_size); add_image_view_relocs(cmd_buffer, desc->image_view, binding->plane, sstate); break; } case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: assert(stage == MESA_SHADER_FRAGMENT); if ((desc->image_view->aspect_mask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0) { /* For depth and stencil input attachments, we treat it like any * old texture that a user may have bound. */ struct anv_surface_state sstate = (desc->layout == VK_IMAGE_LAYOUT_GENERAL) ? desc->image_view->planes[binding->plane].general_sampler_surface_state : desc->image_view->planes[binding->plane].optimal_sampler_surface_state; surface_state = sstate.state; assert(surface_state.alloc_size); add_image_view_relocs(cmd_buffer, desc->image_view, binding->plane, sstate); } else { /* For color input attachments, we create the surface state at * vkBeginRenderPass time so that we can include aux and clear * color information. */ assert(binding->input_attachment_index < subpass->input_count); const unsigned subpass_att = binding->input_attachment_index; const unsigned att = subpass->input_attachments[subpass_att].attachment; surface_state = cmd_buffer->state.attachments[att].input.state; } break; case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: { struct anv_surface_state sstate = (binding->write_only) ? desc->image_view->planes[binding->plane].writeonly_storage_surface_state : desc->image_view->planes[binding->plane].storage_surface_state; surface_state = sstate.state; assert(surface_state.alloc_size); add_image_view_relocs(cmd_buffer, desc->image_view, binding->plane, sstate); struct brw_image_param *image_param = &cmd_buffer->state.push_constants[stage]->images[image++]; *image_param = desc->image_view->planes[binding->plane].storage_image_param; image_param->surface_idx = bias + s; break; } case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: surface_state = desc->buffer_view->surface_state; assert(surface_state.alloc_size); add_surface_state_reloc(cmd_buffer, surface_state, desc->buffer_view->bo, desc->buffer_view->offset); break; case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: { /* Compute the offset within the buffer */ uint32_t dynamic_offset = dynamic_offset_for_binding(pipe_state, pipeline, binding); uint64_t offset = desc->offset + dynamic_offset; /* Clamp to the buffer size */ offset = MIN2(offset, desc->buffer->size); /* Clamp the range to the buffer size */ uint32_t range = MIN2(desc->range, desc->buffer->size - offset); surface_state = anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64); enum isl_format format = anv_isl_format_for_descriptor_type(desc->type); anv_fill_buffer_surface_state(cmd_buffer->device, surface_state, format, offset, range, 1); add_surface_state_reloc(cmd_buffer, surface_state, desc->buffer->bo, desc->buffer->offset + offset); break; } case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: surface_state = (binding->write_only) ? desc->buffer_view->writeonly_storage_surface_state : desc->buffer_view->storage_surface_state; assert(surface_state.alloc_size); add_surface_state_reloc(cmd_buffer, surface_state, desc->buffer_view->bo, desc->buffer_view->offset); struct brw_image_param *image_param = &cmd_buffer->state.push_constants[stage]->images[image++]; *image_param = desc->buffer_view->storage_image_param; image_param->surface_idx = bias + s; break; default: assert(!"Invalid descriptor type"); continue; } bt_map[bias + s] = surface_state.offset + state_offset; } assert(image == map->image_count); out: anv_state_flush(cmd_buffer->device, *bt_state); return VK_SUCCESS; } static VkResult emit_samplers(struct anv_cmd_buffer *cmd_buffer, gl_shader_stage stage, struct anv_state *state) { struct anv_cmd_pipeline_state *pipe_state = stage == MESA_SHADER_COMPUTE ? &cmd_buffer->state.compute.base : &cmd_buffer->state.gfx.base; struct anv_pipeline *pipeline = pipe_state->pipeline; if (!anv_pipeline_has_stage(pipeline, stage)) { *state = (struct anv_state) { 0, }; return VK_SUCCESS; } struct anv_pipeline_bind_map *map = &pipeline->shaders[stage]->bind_map; if (map->sampler_count == 0) { *state = (struct anv_state) { 0, }; return VK_SUCCESS; } uint32_t size = map->sampler_count * 16; *state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, size, 32); if (state->map == NULL) return VK_ERROR_OUT_OF_DEVICE_MEMORY; for (uint32_t s = 0; s < map->sampler_count; s++) { struct anv_pipeline_binding *binding = &map->sampler_to_descriptor[s]; const struct anv_descriptor *desc = anv_descriptor_for_binding(pipe_state, binding); if (desc->type != VK_DESCRIPTOR_TYPE_SAMPLER && desc->type != VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) continue; struct anv_sampler *sampler = desc->sampler; /* This can happen if we have an unfilled slot since TYPE_SAMPLER * happens to be zero. */ if (sampler == NULL) continue; memcpy(state->map + (s * 16), sampler->state[binding->plane], sizeof(sampler->state[0])); } anv_state_flush(cmd_buffer->device, *state); return VK_SUCCESS; } static uint32_t flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer) { struct anv_pipeline *pipeline = cmd_buffer->state.gfx.base.pipeline; VkShaderStageFlags dirty = cmd_buffer->state.descriptors_dirty & pipeline->active_stages; VkResult result = VK_SUCCESS; anv_foreach_stage(s, dirty) { result = emit_samplers(cmd_buffer, s, &cmd_buffer->state.samplers[s]); if (result != VK_SUCCESS) break; result = emit_binding_table(cmd_buffer, s, &cmd_buffer->state.binding_tables[s]); if (result != VK_SUCCESS) break; } if (result != VK_SUCCESS) { assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY); result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); if (result != VK_SUCCESS) return 0; /* Re-emit state base addresses so we get the new surface state base * address before we start emitting binding tables etc. */ genX(cmd_buffer_emit_state_base_address)(cmd_buffer); /* Re-emit all active binding tables */ dirty |= pipeline->active_stages; anv_foreach_stage(s, dirty) { result = emit_samplers(cmd_buffer, s, &cmd_buffer->state.samplers[s]); if (result != VK_SUCCESS) { anv_batch_set_error(&cmd_buffer->batch, result); return 0; } result = emit_binding_table(cmd_buffer, s, &cmd_buffer->state.binding_tables[s]); if (result != VK_SUCCESS) { anv_batch_set_error(&cmd_buffer->batch, result); return 0; } } } cmd_buffer->state.descriptors_dirty &= ~dirty; return dirty; } static void cmd_buffer_emit_descriptor_pointers(struct anv_cmd_buffer *cmd_buffer, uint32_t stages) { static const uint32_t sampler_state_opcodes[] = { [MESA_SHADER_VERTEX] = 43, [MESA_SHADER_TESS_CTRL] = 44, /* HS */ [MESA_SHADER_TESS_EVAL] = 45, /* DS */ [MESA_SHADER_GEOMETRY] = 46, [MESA_SHADER_FRAGMENT] = 47, [MESA_SHADER_COMPUTE] = 0, }; static const uint32_t binding_table_opcodes[] = { [MESA_SHADER_VERTEX] = 38, [MESA_SHADER_TESS_CTRL] = 39, [MESA_SHADER_TESS_EVAL] = 40, [MESA_SHADER_GEOMETRY] = 41, [MESA_SHADER_FRAGMENT] = 42, [MESA_SHADER_COMPUTE] = 0, }; anv_foreach_stage(s, stages) { assert(s < ARRAY_SIZE(binding_table_opcodes)); assert(binding_table_opcodes[s] > 0); if (cmd_buffer->state.samplers[s].alloc_size > 0) { anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_SAMPLER_STATE_POINTERS_VS), ssp) { ssp._3DCommandSubOpcode = sampler_state_opcodes[s]; ssp.PointertoVSSamplerState = cmd_buffer->state.samplers[s].offset; } } /* Always emit binding table pointers if we're asked to, since on SKL * this is what flushes push constants. */ anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_VS), btp) { btp._3DCommandSubOpcode = binding_table_opcodes[s]; btp.PointertoVSBindingTable = cmd_buffer->state.binding_tables[s].offset; } } } static void cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer, VkShaderStageFlags dirty_stages) { const struct anv_cmd_graphics_state *gfx_state = &cmd_buffer->state.gfx; const struct anv_pipeline *pipeline = gfx_state->base.pipeline; static const uint32_t push_constant_opcodes[] = { [MESA_SHADER_VERTEX] = 21, [MESA_SHADER_TESS_CTRL] = 25, /* HS */ [MESA_SHADER_TESS_EVAL] = 26, /* DS */ [MESA_SHADER_GEOMETRY] = 22, [MESA_SHADER_FRAGMENT] = 23, [MESA_SHADER_COMPUTE] = 0, }; VkShaderStageFlags flushed = 0; anv_foreach_stage(stage, dirty_stages) { assert(stage < ARRAY_SIZE(push_constant_opcodes)); assert(push_constant_opcodes[stage] > 0); anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CONSTANT_VS), c) { c._3DCommandSubOpcode = push_constant_opcodes[stage]; if (anv_pipeline_has_stage(pipeline, stage)) { #if GEN_GEN >= 8 || GEN_IS_HASWELL const struct brw_stage_prog_data *prog_data = pipeline->shaders[stage]->prog_data; const struct anv_pipeline_bind_map *bind_map = &pipeline->shaders[stage]->bind_map; /* The Skylake PRM contains the following restriction: * * "The driver must ensure The following case does not occur * without a flush to the 3D engine: 3DSTATE_CONSTANT_* with * buffer 3 read length equal to zero committed followed by a * 3DSTATE_CONSTANT_* with buffer 0 read length not equal to * zero committed." * * To avoid this, we program the buffers in the highest slots. * This way, slot 0 is only used if slot 3 is also used. */ int n = 3; for (int i = 3; i >= 0; i--) { const struct brw_ubo_range *range = &prog_data->ubo_ranges[i]; if (range->length == 0) continue; const unsigned surface = prog_data->binding_table.ubo_start + range->block; assert(surface <= bind_map->surface_count); const struct anv_pipeline_binding *binding = &bind_map->surface_to_descriptor[surface]; const struct anv_descriptor *desc = anv_descriptor_for_binding(&gfx_state->base, binding); struct anv_address read_addr; uint32_t read_len; if (desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) { read_len = MIN2(range->length, DIV_ROUND_UP(desc->buffer_view->range, 32) - range->start); read_addr = (struct anv_address) { .bo = desc->buffer_view->bo, .offset = desc->buffer_view->offset + range->start * 32, }; } else { assert(desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC); uint32_t dynamic_offset = dynamic_offset_for_binding(&gfx_state->base, pipeline, binding); uint32_t buf_offset = MIN2(desc->offset + dynamic_offset, desc->buffer->size); uint32_t buf_range = MIN2(desc->range, desc->buffer->size - buf_offset); read_len = MIN2(range->length, DIV_ROUND_UP(buf_range, 32) - range->start); read_addr = (struct anv_address) { .bo = desc->buffer->bo, .offset = desc->buffer->offset + buf_offset + range->start * 32, }; } if (read_len > 0) { c.ConstantBody.Buffer[n] = read_addr; c.ConstantBody.ReadLength[n] = read_len; n--; } } struct anv_state state = anv_cmd_buffer_push_constants(cmd_buffer, stage); if (state.alloc_size > 0) { c.ConstantBody.Buffer[n] = (struct anv_address) { .bo = &cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = state.offset, }; c.ConstantBody.ReadLength[n] = DIV_ROUND_UP(state.alloc_size, 32); } #else /* For Ivy Bridge, the push constants packets have a different * rule that would require us to iterate in the other direction * and possibly mess around with dynamic state base address. * Don't bother; just emit regular push constants at n = 0. */ struct anv_state state = anv_cmd_buffer_push_constants(cmd_buffer, stage); if (state.alloc_size > 0) { c.ConstantBody.Buffer[0].offset = state.offset, c.ConstantBody.ReadLength[0] = DIV_ROUND_UP(state.alloc_size, 32); } #endif } } flushed |= mesa_to_vk_shader_stage(stage); } cmd_buffer->state.push_constants_dirty &= ~flushed; } void genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) { struct anv_pipeline *pipeline = cmd_buffer->state.gfx.base.pipeline; uint32_t *p; uint32_t vb_emit = cmd_buffer->state.gfx.vb_dirty & pipeline->vb_used; assert((pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT) == 0); genX(cmd_buffer_config_l3)(cmd_buffer, pipeline->urb.l3_config); genX(flush_pipeline_select_3d)(cmd_buffer); if (vb_emit) { const uint32_t num_buffers = __builtin_popcount(vb_emit); const uint32_t num_dwords = 1 + num_buffers * 4; p = anv_batch_emitn(&cmd_buffer->batch, num_dwords, GENX(3DSTATE_VERTEX_BUFFERS)); uint32_t vb, i = 0; for_each_bit(vb, vb_emit) { struct anv_buffer *buffer = cmd_buffer->state.vertex_bindings[vb].buffer; uint32_t offset = cmd_buffer->state.vertex_bindings[vb].offset; struct GENX(VERTEX_BUFFER_STATE) state = { .VertexBufferIndex = vb, #if GEN_GEN >= 8 .MemoryObjectControlState = GENX(MOCS), #else .BufferAccessType = pipeline->instancing_enable[vb] ? INSTANCEDATA : VERTEXDATA, /* Our implementation of VK_KHR_multiview uses instancing to draw * the different views. If the client asks for instancing, we * need to use the Instance Data Step Rate to ensure that we * repeat the client's per-instance data once for each view. */ .InstanceDataStepRate = anv_subpass_view_count(pipeline->subpass), .VertexBufferMemoryObjectControlState = GENX(MOCS), #endif .AddressModifyEnable = true, .BufferPitch = pipeline->binding_stride[vb], .BufferStartingAddress = { buffer->bo, buffer->offset + offset }, #if GEN_GEN >= 8 .BufferSize = buffer->size - offset #else .EndAddress = { buffer->bo, buffer->offset + buffer->size - 1}, #endif }; GENX(VERTEX_BUFFER_STATE_pack)(&cmd_buffer->batch, &p[1 + i * 4], &state); i++; } } cmd_buffer->state.gfx.vb_dirty &= ~vb_emit; if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) { anv_batch_emit_batch(&cmd_buffer->batch, &pipeline->batch); /* The exact descriptor layout is pulled from the pipeline, so we need * to re-emit binding tables on every pipeline change. */ cmd_buffer->state.descriptors_dirty |= pipeline->active_stages; /* If the pipeline changed, we may need to re-allocate push constant * space in the URB. */ cmd_buffer_alloc_push_constants(cmd_buffer); } #if GEN_GEN <= 7 if (cmd_buffer->state.descriptors_dirty & VK_SHADER_STAGE_VERTEX_BIT || cmd_buffer->state.push_constants_dirty & VK_SHADER_STAGE_VERTEX_BIT) { /* From the IVB PRM Vol. 2, Part 1, Section 3.2.1: * * "A PIPE_CONTROL with Post-Sync Operation set to 1h and a depth * stall needs to be sent just prior to any 3DSTATE_VS, * 3DSTATE_URB_VS, 3DSTATE_CONSTANT_VS, * 3DSTATE_BINDING_TABLE_POINTER_VS, * 3DSTATE_SAMPLER_STATE_POINTER_VS command. Only one * PIPE_CONTROL needs to be sent before any combination of VS * associated 3DSTATE." */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.DepthStallEnable = true; pc.PostSyncOperation = WriteImmediateData; pc.Address = (struct anv_address) { &cmd_buffer->device->workaround_bo, 0 }; } } #endif /* Render targets live in the same binding table as fragment descriptors */ if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_RENDER_TARGETS) cmd_buffer->state.descriptors_dirty |= VK_SHADER_STAGE_FRAGMENT_BIT; /* We emit the binding tables and sampler tables first, then emit push * constants and then finally emit binding table and sampler table * pointers. It has to happen in this order, since emitting the binding * tables may change the push constants (in case of storage images). After * emitting push constants, on SKL+ we have to emit the corresponding * 3DSTATE_BINDING_TABLE_POINTER_* for the push constants to take effect. */ uint32_t dirty = 0; if (cmd_buffer->state.descriptors_dirty) dirty = flush_descriptor_sets(cmd_buffer); if (dirty || cmd_buffer->state.push_constants_dirty) { /* Because we're pushing UBOs, we have to push whenever either * descriptors or push constants is dirty. */ dirty |= cmd_buffer->state.push_constants_dirty; dirty &= ANV_STAGE_MASK & VK_SHADER_STAGE_ALL_GRAPHICS; cmd_buffer_flush_push_constants(cmd_buffer, dirty); } if (dirty) cmd_buffer_emit_descriptor_pointers(cmd_buffer, dirty); if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_VIEWPORT) gen8_cmd_buffer_emit_viewport(cmd_buffer); if (cmd_buffer->state.gfx.dirty & (ANV_CMD_DIRTY_DYNAMIC_VIEWPORT | ANV_CMD_DIRTY_PIPELINE)) { gen8_cmd_buffer_emit_depth_viewport(cmd_buffer, pipeline->depth_clamp_enable); } if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_SCISSOR) gen7_cmd_buffer_emit_scissor(cmd_buffer); genX(cmd_buffer_flush_dynamic_state)(cmd_buffer); genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer); } static void emit_vertex_bo(struct anv_cmd_buffer *cmd_buffer, struct anv_bo *bo, uint32_t offset, uint32_t size, uint32_t index) { uint32_t *p = anv_batch_emitn(&cmd_buffer->batch, 5, GENX(3DSTATE_VERTEX_BUFFERS)); GENX(VERTEX_BUFFER_STATE_pack)(&cmd_buffer->batch, p + 1, &(struct GENX(VERTEX_BUFFER_STATE)) { .VertexBufferIndex = index, .AddressModifyEnable = true, .BufferPitch = 0, #if (GEN_GEN >= 8) .MemoryObjectControlState = GENX(MOCS), .BufferStartingAddress = { bo, offset }, .BufferSize = size #else .VertexBufferMemoryObjectControlState = GENX(MOCS), .BufferStartingAddress = { bo, offset }, .EndAddress = { bo, offset + size }, #endif }); } static void emit_base_vertex_instance_bo(struct anv_cmd_buffer *cmd_buffer, struct anv_bo *bo, uint32_t offset) { emit_vertex_bo(cmd_buffer, bo, offset, 8, ANV_SVGS_VB_INDEX); } static void emit_base_vertex_instance(struct anv_cmd_buffer *cmd_buffer, uint32_t base_vertex, uint32_t base_instance) { struct anv_state id_state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 8, 4); ((uint32_t *)id_state.map)[0] = base_vertex; ((uint32_t *)id_state.map)[1] = base_instance; anv_state_flush(cmd_buffer->device, id_state); emit_base_vertex_instance_bo(cmd_buffer, &cmd_buffer->device->dynamic_state_pool.block_pool.bo, id_state.offset); } static void emit_draw_index(struct anv_cmd_buffer *cmd_buffer, uint32_t draw_index) { struct anv_state state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 4, 4); ((uint32_t *)state.map)[0] = draw_index; anv_state_flush(cmd_buffer->device, state); emit_vertex_bo(cmd_buffer, &cmd_buffer->device->dynamic_state_pool.block_pool.bo, state.offset, 4, ANV_DRAWID_VB_INDEX); } void genX(CmdDraw)( VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); struct anv_pipeline *pipeline = cmd_buffer->state.gfx.base.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); if (anv_batch_has_error(&cmd_buffer->batch)) return; genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) emit_base_vertex_instance(cmd_buffer, firstVertex, firstInstance); if (vs_prog_data->uses_drawid) emit_draw_index(cmd_buffer, 0); /* Our implementation of VK_KHR_multiview uses instancing to draw the * different views. We need to multiply instanceCount by the view count. */ instanceCount *= anv_subpass_view_count(cmd_buffer->state.subpass); anv_batch_emit(&cmd_buffer->batch, GENX(3DPRIMITIVE), prim) { prim.VertexAccessType = SEQUENTIAL; prim.PrimitiveTopologyType = pipeline->topology; prim.VertexCountPerInstance = vertexCount; prim.StartVertexLocation = firstVertex; prim.InstanceCount = instanceCount; prim.StartInstanceLocation = firstInstance; prim.BaseVertexLocation = 0; } } void genX(CmdDrawIndexed)( VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); struct anv_pipeline *pipeline = cmd_buffer->state.gfx.base.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); if (anv_batch_has_error(&cmd_buffer->batch)) return; genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) emit_base_vertex_instance(cmd_buffer, vertexOffset, firstInstance); if (vs_prog_data->uses_drawid) emit_draw_index(cmd_buffer, 0); /* Our implementation of VK_KHR_multiview uses instancing to draw the * different views. We need to multiply instanceCount by the view count. */ instanceCount *= anv_subpass_view_count(cmd_buffer->state.subpass); anv_batch_emit(&cmd_buffer->batch, GENX(3DPRIMITIVE), prim) { prim.VertexAccessType = RANDOM; prim.PrimitiveTopologyType = pipeline->topology; prim.VertexCountPerInstance = indexCount; prim.StartVertexLocation = firstIndex; prim.InstanceCount = instanceCount; prim.StartInstanceLocation = firstInstance; prim.BaseVertexLocation = vertexOffset; } } /* Auto-Draw / Indirect Registers */ #define GEN7_3DPRIM_END_OFFSET 0x2420 #define GEN7_3DPRIM_START_VERTEX 0x2430 #define GEN7_3DPRIM_VERTEX_COUNT 0x2434 #define GEN7_3DPRIM_INSTANCE_COUNT 0x2438 #define GEN7_3DPRIM_START_INSTANCE 0x243C #define GEN7_3DPRIM_BASE_VERTEX 0x2440 /* MI_MATH only exists on Haswell+ */ #if GEN_IS_HASWELL || GEN_GEN >= 8 static uint32_t mi_alu(uint32_t opcode, uint32_t op1, uint32_t op2) { struct GENX(MI_MATH_ALU_INSTRUCTION) instr = { .ALUOpcode = opcode, .Operand1 = op1, .Operand2 = op2, }; uint32_t dw; GENX(MI_MATH_ALU_INSTRUCTION_pack)(NULL, &dw, &instr); return dw; } #define CS_GPR(n) (0x2600 + (n) * 8) /* Emit dwords to multiply GPR0 by N */ static void build_alu_multiply_gpr0(uint32_t *dw, unsigned *dw_count, uint32_t N) { VK_OUTARRAY_MAKE(out, dw, dw_count); #define append_alu(opcode, operand1, operand2) \ vk_outarray_append(&out, alu_dw) *alu_dw = mi_alu(opcode, operand1, operand2) assert(N > 0); unsigned top_bit = 31 - __builtin_clz(N); for (int i = top_bit - 1; i >= 0; i--) { /* We get our initial data in GPR0 and we write the final data out to * GPR0 but we use GPR1 as our scratch register. */ unsigned src_reg = i == top_bit - 1 ? MI_ALU_REG0 : MI_ALU_REG1; unsigned dst_reg = i == 0 ? MI_ALU_REG0 : MI_ALU_REG1; /* Shift the current value left by 1 */ append_alu(MI_ALU_LOAD, MI_ALU_SRCA, src_reg); append_alu(MI_ALU_LOAD, MI_ALU_SRCB, src_reg); append_alu(MI_ALU_ADD, 0, 0); if (N & (1 << i)) { /* Store ACCU to R1 and add R0 to R1 */ append_alu(MI_ALU_STORE, MI_ALU_REG1, MI_ALU_ACCU); append_alu(MI_ALU_LOAD, MI_ALU_SRCA, MI_ALU_REG0); append_alu(MI_ALU_LOAD, MI_ALU_SRCB, MI_ALU_REG1); append_alu(MI_ALU_ADD, 0, 0); } append_alu(MI_ALU_STORE, dst_reg, MI_ALU_ACCU); } #undef append_alu } static void emit_mul_gpr0(struct anv_batch *batch, uint32_t N) { uint32_t num_dwords; build_alu_multiply_gpr0(NULL, &num_dwords, N); uint32_t *dw = anv_batch_emitn(batch, 1 + num_dwords, GENX(MI_MATH)); build_alu_multiply_gpr0(dw + 1, &num_dwords, N); } #endif /* GEN_IS_HASWELL || GEN_GEN >= 8 */ static void load_indirect_parameters(struct anv_cmd_buffer *cmd_buffer, struct anv_buffer *buffer, uint64_t offset, bool indexed) { struct anv_batch *batch = &cmd_buffer->batch; struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; emit_lrm(batch, GEN7_3DPRIM_VERTEX_COUNT, bo, bo_offset); unsigned view_count = anv_subpass_view_count(cmd_buffer->state.subpass); if (view_count > 1) { #if GEN_IS_HASWELL || GEN_GEN >= 8 emit_lrm(batch, CS_GPR(0), bo, bo_offset + 4); emit_mul_gpr0(batch, view_count); emit_lrr(batch, GEN7_3DPRIM_INSTANCE_COUNT, CS_GPR(0)); #else anv_finishme("Multiview + indirect draw requires MI_MATH; " "MI_MATH is not supported on Ivy Bridge"); emit_lrm(batch, GEN7_3DPRIM_INSTANCE_COUNT, bo, bo_offset + 4); #endif } else { emit_lrm(batch, GEN7_3DPRIM_INSTANCE_COUNT, bo, bo_offset + 4); } emit_lrm(batch, GEN7_3DPRIM_START_VERTEX, bo, bo_offset + 8); if (indexed) { emit_lrm(batch, GEN7_3DPRIM_BASE_VERTEX, bo, bo_offset + 12); emit_lrm(batch, GEN7_3DPRIM_START_INSTANCE, bo, bo_offset + 16); } else { emit_lrm(batch, GEN7_3DPRIM_START_INSTANCE, bo, bo_offset + 12); emit_lri(batch, GEN7_3DPRIM_BASE_VERTEX, 0); } } void genX(CmdDrawIndirect)( VkCommandBuffer commandBuffer, VkBuffer _buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); ANV_FROM_HANDLE(anv_buffer, buffer, _buffer); struct anv_pipeline *pipeline = cmd_buffer->state.gfx.base.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); if (anv_batch_has_error(&cmd_buffer->batch)) return; genX(cmd_buffer_flush_state)(cmd_buffer); for (uint32_t i = 0; i < drawCount; i++) { struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) emit_base_vertex_instance_bo(cmd_buffer, bo, bo_offset + 8); if (vs_prog_data->uses_drawid) emit_draw_index(cmd_buffer, i); load_indirect_parameters(cmd_buffer, buffer, offset, false); anv_batch_emit(&cmd_buffer->batch, GENX(3DPRIMITIVE), prim) { prim.IndirectParameterEnable = true; prim.VertexAccessType = SEQUENTIAL; prim.PrimitiveTopologyType = pipeline->topology; } offset += stride; } } void genX(CmdDrawIndexedIndirect)( VkCommandBuffer commandBuffer, VkBuffer _buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); ANV_FROM_HANDLE(anv_buffer, buffer, _buffer); struct anv_pipeline *pipeline = cmd_buffer->state.gfx.base.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); if (anv_batch_has_error(&cmd_buffer->batch)) return; genX(cmd_buffer_flush_state)(cmd_buffer); for (uint32_t i = 0; i < drawCount; i++) { struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; /* TODO: We need to stomp base vertex to 0 somehow */ if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) emit_base_vertex_instance_bo(cmd_buffer, bo, bo_offset + 12); if (vs_prog_data->uses_drawid) emit_draw_index(cmd_buffer, i); load_indirect_parameters(cmd_buffer, buffer, offset, true); anv_batch_emit(&cmd_buffer->batch, GENX(3DPRIMITIVE), prim) { prim.IndirectParameterEnable = true; prim.VertexAccessType = RANDOM; prim.PrimitiveTopologyType = pipeline->topology; } offset += stride; } } static VkResult flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer) { struct anv_pipeline *pipeline = cmd_buffer->state.compute.base.pipeline; struct anv_state surfaces = { 0, }, samplers = { 0, }; VkResult result; result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE, &surfaces); if (result != VK_SUCCESS) { assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY); result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); if (result != VK_SUCCESS) return result; /* Re-emit state base addresses so we get the new surface state base * address before we start emitting binding tables etc. */ genX(cmd_buffer_emit_state_base_address)(cmd_buffer); result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE, &surfaces); if (result != VK_SUCCESS) { anv_batch_set_error(&cmd_buffer->batch, result); return result; } } result = emit_samplers(cmd_buffer, MESA_SHADER_COMPUTE, &samplers); if (result != VK_SUCCESS) { anv_batch_set_error(&cmd_buffer->batch, result); return result; } uint32_t iface_desc_data_dw[GENX(INTERFACE_DESCRIPTOR_DATA_length)]; struct GENX(INTERFACE_DESCRIPTOR_DATA) desc = { .BindingTablePointer = surfaces.offset, .SamplerStatePointer = samplers.offset, }; GENX(INTERFACE_DESCRIPTOR_DATA_pack)(NULL, iface_desc_data_dw, &desc); struct anv_state state = anv_cmd_buffer_merge_dynamic(cmd_buffer, iface_desc_data_dw, pipeline->interface_descriptor_data, GENX(INTERFACE_DESCRIPTOR_DATA_length), 64); uint32_t size = GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t); anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_INTERFACE_DESCRIPTOR_LOAD), mid) { mid.InterfaceDescriptorTotalLength = size; mid.InterfaceDescriptorDataStartAddress = state.offset; } return VK_SUCCESS; } void genX(cmd_buffer_flush_compute_state)(struct anv_cmd_buffer *cmd_buffer) { struct anv_pipeline *pipeline = cmd_buffer->state.compute.base.pipeline; MAYBE_UNUSED VkResult result; assert(pipeline->active_stages == VK_SHADER_STAGE_COMPUTE_BIT); genX(cmd_buffer_config_l3)(cmd_buffer, pipeline->urb.l3_config); genX(flush_pipeline_select_gpgpu)(cmd_buffer); if (cmd_buffer->state.compute.pipeline_dirty) { /* From the Sky Lake PRM Vol 2a, MEDIA_VFE_STATE: * * "A stalling PIPE_CONTROL is required before MEDIA_VFE_STATE unless * the only bits that are changed are scoreboard related: Scoreboard * Enable, Scoreboard Type, Scoreboard Mask, Scoreboard * Delta. For * these scoreboard related states, a MEDIA_STATE_FLUSH is * sufficient." */ cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_CS_STALL_BIT; genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer); anv_batch_emit_batch(&cmd_buffer->batch, &pipeline->batch); } if ((cmd_buffer->state.descriptors_dirty & VK_SHADER_STAGE_COMPUTE_BIT) || cmd_buffer->state.compute.pipeline_dirty) { /* FIXME: figure out descriptors for gen7 */ result = flush_compute_descriptor_set(cmd_buffer); if (result != VK_SUCCESS) return; cmd_buffer->state.descriptors_dirty &= ~VK_SHADER_STAGE_COMPUTE_BIT; } if (cmd_buffer->state.push_constants_dirty & VK_SHADER_STAGE_COMPUTE_BIT) { struct anv_state push_state = anv_cmd_buffer_cs_push_constants(cmd_buffer); if (push_state.alloc_size) { anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_CURBE_LOAD), curbe) { curbe.CURBETotalDataLength = push_state.alloc_size; curbe.CURBEDataStartAddress = push_state.offset; } } } cmd_buffer->state.compute.pipeline_dirty = false; genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer); } #if GEN_GEN == 7 static VkResult verify_cmd_parser(const struct anv_device *device, int required_version, const char *function) { if (device->instance->physicalDevice.cmd_parser_version < required_version) { return vk_errorf(device->instance, device->instance, VK_ERROR_FEATURE_NOT_PRESENT, "cmd parser version %d is required for %s", required_version, function); } else { return VK_SUCCESS; } } #endif void genX(CmdDispatch)( VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); struct anv_pipeline *pipeline = cmd_buffer->state.compute.base.pipeline; const struct brw_cs_prog_data *prog_data = get_cs_prog_data(pipeline); if (anv_batch_has_error(&cmd_buffer->batch)) return; if (prog_data->uses_num_work_groups) { struct anv_state state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 12, 4); uint32_t *sizes = state.map; sizes[0] = x; sizes[1] = y; sizes[2] = z; anv_state_flush(cmd_buffer->device, state); cmd_buffer->state.compute.num_workgroups = (struct anv_address) { .bo = &cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = state.offset, }; } genX(cmd_buffer_flush_compute_state)(cmd_buffer); anv_batch_emit(&cmd_buffer->batch, GENX(GPGPU_WALKER), ggw) { ggw.SIMDSize = prog_data->simd_size / 16; ggw.ThreadDepthCounterMaximum = 0; ggw.ThreadHeightCounterMaximum = 0; ggw.ThreadWidthCounterMaximum = prog_data->threads - 1; ggw.ThreadGroupIDXDimension = x; ggw.ThreadGroupIDYDimension = y; ggw.ThreadGroupIDZDimension = z; ggw.RightExecutionMask = pipeline->cs_right_mask; ggw.BottomExecutionMask = 0xffffffff; } anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_STATE_FLUSH), msf); } #define GPGPU_DISPATCHDIMX 0x2500 #define GPGPU_DISPATCHDIMY 0x2504 #define GPGPU_DISPATCHDIMZ 0x2508 void genX(CmdDispatchIndirect)( VkCommandBuffer commandBuffer, VkBuffer _buffer, VkDeviceSize offset) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); ANV_FROM_HANDLE(anv_buffer, buffer, _buffer); struct anv_pipeline *pipeline = cmd_buffer->state.compute.base.pipeline; const struct brw_cs_prog_data *prog_data = get_cs_prog_data(pipeline); struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; struct anv_batch *batch = &cmd_buffer->batch; #if GEN_GEN == 7 /* Linux 4.4 added command parser version 5 which allows the GPGPU * indirect dispatch registers to be written. */ if (verify_cmd_parser(cmd_buffer->device, 5, "vkCmdDispatchIndirect") != VK_SUCCESS) return; #endif if (prog_data->uses_num_work_groups) { cmd_buffer->state.compute.num_workgroups = (struct anv_address) { .bo = bo, .offset = bo_offset, }; } genX(cmd_buffer_flush_compute_state)(cmd_buffer); emit_lrm(batch, GPGPU_DISPATCHDIMX, bo, bo_offset); emit_lrm(batch, GPGPU_DISPATCHDIMY, bo, bo_offset + 4); emit_lrm(batch, GPGPU_DISPATCHDIMZ, bo, bo_offset + 8); #if GEN_GEN <= 7 /* Clear upper 32-bits of SRC0 and all 64-bits of SRC1 */ emit_lri(batch, MI_PREDICATE_SRC0 + 4, 0); emit_lri(batch, MI_PREDICATE_SRC1 + 0, 0); emit_lri(batch, MI_PREDICATE_SRC1 + 4, 0); /* Load compute_dispatch_indirect_x_size into SRC0 */ emit_lrm(batch, MI_PREDICATE_SRC0, bo, bo_offset + 0); /* predicate = (compute_dispatch_indirect_x_size == 0); */ anv_batch_emit(batch, GENX(MI_PREDICATE), mip) { mip.LoadOperation = LOAD_LOAD; mip.CombineOperation = COMBINE_SET; mip.CompareOperation = COMPARE_SRCS_EQUAL; } /* Load compute_dispatch_indirect_y_size into SRC0 */ emit_lrm(batch, MI_PREDICATE_SRC0, bo, bo_offset + 4); /* predicate |= (compute_dispatch_indirect_y_size == 0); */ anv_batch_emit(batch, GENX(MI_PREDICATE), mip) { mip.LoadOperation = LOAD_LOAD; mip.CombineOperation = COMBINE_OR; mip.CompareOperation = COMPARE_SRCS_EQUAL; } /* Load compute_dispatch_indirect_z_size into SRC0 */ emit_lrm(batch, MI_PREDICATE_SRC0, bo, bo_offset + 8); /* predicate |= (compute_dispatch_indirect_z_size == 0); */ anv_batch_emit(batch, GENX(MI_PREDICATE), mip) { mip.LoadOperation = LOAD_LOAD; mip.CombineOperation = COMBINE_OR; mip.CompareOperation = COMPARE_SRCS_EQUAL; } /* predicate = !predicate; */ #define COMPARE_FALSE 1 anv_batch_emit(batch, GENX(MI_PREDICATE), mip) { mip.LoadOperation = LOAD_LOADINV; mip.CombineOperation = COMBINE_OR; mip.CompareOperation = COMPARE_FALSE; } #endif anv_batch_emit(batch, GENX(GPGPU_WALKER), ggw) { ggw.IndirectParameterEnable = true; ggw.PredicateEnable = GEN_GEN <= 7; ggw.SIMDSize = prog_data->simd_size / 16; ggw.ThreadDepthCounterMaximum = 0; ggw.ThreadHeightCounterMaximum = 0; ggw.ThreadWidthCounterMaximum = prog_data->threads - 1; ggw.RightExecutionMask = pipeline->cs_right_mask; ggw.BottomExecutionMask = 0xffffffff; } anv_batch_emit(batch, GENX(MEDIA_STATE_FLUSH), msf); } static void genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer, uint32_t pipeline) { UNUSED const struct gen_device_info *devinfo = &cmd_buffer->device->info; if (cmd_buffer->state.current_pipeline == pipeline) return; #if GEN_GEN >= 8 && GEN_GEN < 10 /* From the Broadwell PRM, Volume 2a: Instructions, PIPELINE_SELECT: * * Software must clear the COLOR_CALC_STATE Valid field in * 3DSTATE_CC_STATE_POINTERS command prior to send a PIPELINE_SELECT * with Pipeline Select set to GPGPU. * * The internal hardware docs recommend the same workaround for Gen9 * hardware too. */ if (pipeline == GPGPU) anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), t); #endif /* From "BXML » GT » MI » vol1a GPU Overview » [Instruction] * PIPELINE_SELECT [DevBWR+]": * * Project: DEVSNB+ * * Software must ensure all the write caches are flushed through a * stalling PIPE_CONTROL command followed by another PIPE_CONTROL * command to invalidate read only caches prior to programming * MI_PIPELINE_SELECT command to change the Pipeline Select Mode. */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.RenderTargetCacheFlushEnable = true; pc.DepthCacheFlushEnable = true; pc.DCFlushEnable = true; pc.PostSyncOperation = NoWrite; pc.CommandStreamerStallEnable = true; } anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.TextureCacheInvalidationEnable = true; pc.ConstantCacheInvalidationEnable = true; pc.StateCacheInvalidationEnable = true; pc.InstructionCacheInvalidateEnable = true; pc.PostSyncOperation = NoWrite; } anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT), ps) { #if GEN_GEN >= 9 ps.MaskBits = 3; #endif ps.PipelineSelection = pipeline; } #if GEN_GEN == 9 if (devinfo->is_geminilake) { /* Project: DevGLK * * "This chicken bit works around a hardware issue with barrier logic * encountered when switching between GPGPU and 3D pipelines. To * workaround the issue, this mode bit should be set after a pipeline * is selected." */ uint32_t scec; anv_pack_struct(&scec, GENX(SLICE_COMMON_ECO_CHICKEN1), .GLKBarrierMode = pipeline == GPGPU ? GLK_BARRIER_MODE_GPGPU : GLK_BARRIER_MODE_3D_HULL, .GLKBarrierModeMask = 1); emit_lri(&cmd_buffer->batch, GENX(SLICE_COMMON_ECO_CHICKEN1_num), scec); } #endif cmd_buffer->state.current_pipeline = pipeline; } void genX(flush_pipeline_select_3d)(struct anv_cmd_buffer *cmd_buffer) { genX(flush_pipeline_select)(cmd_buffer, _3D); } void genX(flush_pipeline_select_gpgpu)(struct anv_cmd_buffer *cmd_buffer) { genX(flush_pipeline_select)(cmd_buffer, GPGPU); } void genX(cmd_buffer_emit_gen7_depth_flush)(struct anv_cmd_buffer *cmd_buffer) { if (GEN_GEN >= 8) return; /* From the Haswell PRM, documentation for 3DSTATE_DEPTH_BUFFER: * * "Restriction: Prior to changing Depth/Stencil Buffer state (i.e., any * combination of 3DSTATE_DEPTH_BUFFER, 3DSTATE_CLEAR_PARAMS, * 3DSTATE_STENCIL_BUFFER, 3DSTATE_HIER_DEPTH_BUFFER) SW must first * issue a pipelined depth stall (PIPE_CONTROL with Depth Stall bit * set), followed by a pipelined depth cache flush (PIPE_CONTROL with * Depth Flush Bit set, followed by another pipelined depth stall * (PIPE_CONTROL with Depth Stall Bit set), unless SW can otherwise * guarantee that the pipeline from WM onwards is already flushed (e.g., * via a preceding MI_FLUSH)." */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pipe) { pipe.DepthStallEnable = true; } anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pipe) { pipe.DepthCacheFlushEnable = true; } anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pipe) { pipe.DepthStallEnable = true; } } static void cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) { struct anv_device *device = cmd_buffer->device; const struct anv_image_view *iview = anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); const struct anv_image *image = iview ? iview->image : NULL; /* FIXME: Width and Height are wrong */ genX(cmd_buffer_emit_gen7_depth_flush)(cmd_buffer); uint32_t *dw = anv_batch_emit_dwords(&cmd_buffer->batch, device->isl_dev.ds.size / 4); if (dw == NULL) return; struct isl_depth_stencil_hiz_emit_info info = { .mocs = device->default_mocs, }; if (iview) info.view = &iview->planes[0].isl; if (image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) { uint32_t depth_plane = anv_image_aspect_to_plane(image->aspects, VK_IMAGE_ASPECT_DEPTH_BIT); const struct anv_surface *surface = &image->planes[depth_plane].surface; info.depth_surf = &surface->isl; info.depth_address = anv_batch_emit_reloc(&cmd_buffer->batch, dw + device->isl_dev.ds.depth_offset / 4, image->planes[depth_plane].bo, image->planes[depth_plane].bo_offset + surface->offset); const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment.attachment; info.hiz_usage = cmd_buffer->state.attachments[ds].aux_usage; if (info.hiz_usage == ISL_AUX_USAGE_HIZ) { info.hiz_surf = &image->planes[depth_plane].aux_surface.isl; info.hiz_address = anv_batch_emit_reloc(&cmd_buffer->batch, dw + device->isl_dev.ds.hiz_offset / 4, image->planes[depth_plane].bo, image->planes[depth_plane].bo_offset + image->planes[depth_plane].aux_surface.offset); info.depth_clear_value = ANV_HZ_FC_VAL; } } if (image && (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT)) { uint32_t stencil_plane = anv_image_aspect_to_plane(image->aspects, VK_IMAGE_ASPECT_STENCIL_BIT); const struct anv_surface *surface = &image->planes[stencil_plane].surface; info.stencil_surf = &surface->isl; info.stencil_address = anv_batch_emit_reloc(&cmd_buffer->batch, dw + device->isl_dev.ds.stencil_offset / 4, image->planes[stencil_plane].bo, image->planes[stencil_plane].bo_offset + surface->offset); } isl_emit_depth_stencil_hiz_s(&device->isl_dev, dw, &info); cmd_buffer->state.hiz_enabled = info.hiz_usage == ISL_AUX_USAGE_HIZ; } /** * @brief Perform any layout transitions required at the beginning and/or end * of the current subpass for depth buffers. * * TODO: Consider preprocessing the attachment reference array at render pass * create time to determine if no layout transition is needed at the * beginning and/or end of each subpass. * * @param cmd_buffer The command buffer the transition is happening within. * @param subpass_end If true, marks that the transition is happening at the * end of the subpass. */ static void cmd_buffer_subpass_transition_layouts(struct anv_cmd_buffer * const cmd_buffer, const bool subpass_end) { /* We need a non-NULL command buffer. */ assert(cmd_buffer); const struct anv_cmd_state * const cmd_state = &cmd_buffer->state; const struct anv_subpass * const subpass = cmd_state->subpass; /* This function must be called within a subpass. */ assert(subpass); /* If there are attachment references, the array shouldn't be NULL. */ if (subpass->attachment_count > 0) assert(subpass->attachments); /* Iterate over the array of attachment references. */ for (const VkAttachmentReference *att_ref = subpass->attachments; att_ref < subpass->attachments + subpass->attachment_count; att_ref++) { /* If the attachment is unused, we can't perform a layout transition. */ if (att_ref->attachment == VK_ATTACHMENT_UNUSED) continue; /* This attachment index shouldn't go out of bounds. */ assert(att_ref->attachment < cmd_state->pass->attachment_count); const struct anv_render_pass_attachment * const att_desc = &cmd_state->pass->attachments[att_ref->attachment]; struct anv_attachment_state * const att_state = &cmd_buffer->state.attachments[att_ref->attachment]; /* The attachment should not be used in a subpass after its last. */ assert(att_desc->last_subpass_idx >= anv_get_subpass_id(cmd_state)); if (subpass_end && anv_get_subpass_id(cmd_state) < att_desc->last_subpass_idx) { /* We're calling this function on a buffer twice in one subpass and * this is not the last use of the buffer. The layout should not have * changed from the first call and no transition is necessary. */ assert(att_state->current_layout == att_ref->layout || att_state->current_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); continue; } /* The attachment index must be less than the number of attachments * within the framebuffer. */ assert(att_ref->attachment < cmd_state->framebuffer->attachment_count); const struct anv_image_view * const iview = cmd_state->framebuffer->attachments[att_ref->attachment]; const struct anv_image * const image = iview->image; /* Get the appropriate target layout for this attachment. */ VkImageLayout target_layout; /* A resolve is necessary before use as an input attachment if the clear * color or auxiliary buffer usage isn't supported by the sampler. */ const bool input_needs_resolve = (att_state->fast_clear && !att_state->clear_color_is_zero_one) || att_state->input_aux_usage != att_state->aux_usage; if (subpass_end) { target_layout = att_desc->final_layout; } else if (iview->aspect_mask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV && !input_needs_resolve) { /* Layout transitions before the final only help to enable sampling as * an input attachment. If the input attachment supports sampling * using the auxiliary surface, we can skip such transitions by making * the target layout one that is CCS-aware. */ target_layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; } else { target_layout = att_ref->layout; } /* Perform the layout transition. */ if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) { transition_depth_buffer(cmd_buffer, image, att_state->current_layout, target_layout); att_state->aux_usage = anv_layout_to_aux_usage(&cmd_buffer->device->info, image, VK_IMAGE_ASPECT_DEPTH_BIT, target_layout); } else if (image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) { assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT); transition_color_buffer(cmd_buffer, image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level, 1, iview->planes[0].isl.base_array_layer, iview->planes[0].isl.array_len, att_state->current_layout, target_layout); } att_state->current_layout = target_layout; } } /* Update the clear value dword(s) in surface state objects or the fast clear * state buffer entry for the color attachments used in this subpass. */ static void cmd_buffer_subpass_sync_fast_clear_values(struct anv_cmd_buffer *cmd_buffer) { assert(cmd_buffer && cmd_buffer->state.subpass); const struct anv_cmd_state *state = &cmd_buffer->state; /* Iterate through every color attachment used in this subpass. */ for (uint32_t i = 0; i < state->subpass->color_count; ++i) { /* The attachment should be one of the attachments described in the * render pass and used in the subpass. */ const uint32_t a = state->subpass->color_attachments[i].attachment; if (a == VK_ATTACHMENT_UNUSED) continue; assert(a < state->pass->attachment_count); /* Store some information regarding this attachment. */ const struct anv_attachment_state *att_state = &state->attachments[a]; const struct anv_image_view *iview = state->framebuffer->attachments[a]; const struct anv_render_pass_attachment *rp_att = &state->pass->attachments[a]; if (att_state->aux_usage == ISL_AUX_USAGE_NONE) continue; /* The fast clear state entry must be updated if a fast clear is going to * happen. The surface state must be updated if the clear value from a * prior fast clear may be needed. */ if (att_state->pending_clear_aspects && att_state->fast_clear) { /* Update the fast clear state entry. */ genX(copy_fast_clear_dwords)(cmd_buffer, att_state->color.state, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level, true /* copy from ss */); /* Fast-clears impact whether or not a resolve will be necessary. */ if (iview->image->planes[0].aux_usage == ISL_AUX_USAGE_CCS_E && att_state->clear_color_is_zero) { /* This image always has the auxiliary buffer enabled. We can mark * the subresource as not needing a resolve because the clear color * will match what's in every RENDER_SURFACE_STATE object when it's * being used for sampling. */ genX(set_image_needs_resolve)(cmd_buffer, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level, false); } else { genX(set_image_needs_resolve)(cmd_buffer, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level, true); } } else if (rp_att->load_op == VK_ATTACHMENT_LOAD_OP_LOAD) { /* The attachment may have been fast-cleared in a previous render * pass and the value is needed now. Update the surface state(s). * * TODO: Do this only once per render pass instead of every subpass. */ genX(copy_fast_clear_dwords)(cmd_buffer, att_state->color.state, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level, false /* copy to ss */); if (need_input_attachment_state(rp_att) && att_state->input_aux_usage != ISL_AUX_USAGE_NONE) { genX(copy_fast_clear_dwords)(cmd_buffer, att_state->input.state, iview->image, VK_IMAGE_ASPECT_COLOR_BIT, iview->planes[0].isl.base_level, false /* copy to ss */); } } } } static void genX(cmd_buffer_set_subpass)(struct anv_cmd_buffer *cmd_buffer, struct anv_subpass *subpass) { cmd_buffer->state.subpass = subpass; cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS; /* Our implementation of VK_KHR_multiview uses instancing to draw the * different views. If the client asks for instancing, we need to use the * Instance Data Step Rate to ensure that we repeat the client's * per-instance data once for each view. Since this bit is in * VERTEX_BUFFER_STATE on gen7, we need to dirty vertex buffers at the top * of each subpass. */ if (GEN_GEN == 7) cmd_buffer->state.gfx.vb_dirty |= ~0; /* It is possible to start a render pass with an old pipeline. Because the * render pass and subpass index are both baked into the pipeline, this is * highly unlikely. In order to do so, it requires that you have a render * pass with a single subpass and that you use that render pass twice * back-to-back and use the same pipeline at the start of the second render * pass as at the end of the first. In order to avoid unpredictable issues * with this edge case, we just dirty the pipeline at the start of every * subpass. */ cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_PIPELINE; /* Perform transitions to the subpass layout before any writes have * occurred. */ cmd_buffer_subpass_transition_layouts(cmd_buffer, false); /* Update clear values *after* performing automatic layout transitions. * This ensures that transitions from the UNDEFINED layout have had a chance * to populate the clear value buffer with the correct values for the * LOAD_OP_LOAD loadOp and that the fast-clears will update the buffer * without the aforementioned layout transition overwriting the fast-clear * value. */ cmd_buffer_subpass_sync_fast_clear_values(cmd_buffer); cmd_buffer_emit_depth_stencil(cmd_buffer); anv_cmd_buffer_clear_subpass(cmd_buffer); } void genX(CmdBeginRenderPass)( VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); ANV_FROM_HANDLE(anv_render_pass, pass, pRenderPassBegin->renderPass); ANV_FROM_HANDLE(anv_framebuffer, framebuffer, pRenderPassBegin->framebuffer); cmd_buffer->state.framebuffer = framebuffer; cmd_buffer->state.pass = pass; cmd_buffer->state.render_area = pRenderPassBegin->renderArea; VkResult result = genX(cmd_buffer_setup_attachments)(cmd_buffer, pass, pRenderPassBegin); /* If we failed to setup the attachments we should not try to go further */ if (result != VK_SUCCESS) { assert(anv_batch_has_error(&cmd_buffer->batch)); return; } genX(flush_pipeline_select_3d)(cmd_buffer); genX(cmd_buffer_set_subpass)(cmd_buffer, pass->subpasses); cmd_buffer->state.pending_pipe_bits |= cmd_buffer->state.pass->subpass_flushes[0]; } void genX(CmdNextSubpass)( VkCommandBuffer commandBuffer, VkSubpassContents contents) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); if (anv_batch_has_error(&cmd_buffer->batch)) return; assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); anv_cmd_buffer_resolve_subpass(cmd_buffer); /* Perform transitions to the final layout after all writes have occurred. */ cmd_buffer_subpass_transition_layouts(cmd_buffer, true); genX(cmd_buffer_set_subpass)(cmd_buffer, cmd_buffer->state.subpass + 1); uint32_t subpass_id = anv_get_subpass_id(&cmd_buffer->state); cmd_buffer->state.pending_pipe_bits |= cmd_buffer->state.pass->subpass_flushes[subpass_id]; } void genX(CmdEndRenderPass)( VkCommandBuffer commandBuffer) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); if (anv_batch_has_error(&cmd_buffer->batch)) return; anv_cmd_buffer_resolve_subpass(cmd_buffer); /* Perform transitions to the final layout after all writes have occurred. */ cmd_buffer_subpass_transition_layouts(cmd_buffer, true); cmd_buffer->state.pending_pipe_bits |= cmd_buffer->state.pass->subpass_flushes[cmd_buffer->state.pass->subpass_count]; cmd_buffer->state.hiz_enabled = false; #ifndef NDEBUG anv_dump_add_framebuffer(cmd_buffer, cmd_buffer->state.framebuffer); #endif /* Remove references to render pass specific state. This enables us to * detect whether or not we're in a renderpass. */ cmd_buffer->state.framebuffer = NULL; cmd_buffer->state.pass = NULL; cmd_buffer->state.subpass = NULL; }
39.544826
92
0.644511
[ "render", "object", "3d" ]
360d405f6a9c5a5a616251f8142f4af0b6c57e87
477
h
C
lib/game/include/GameRules.h
rsehmbi/social--gaming
e3c46e1029e2b1b9ee42d48a30c2bf591aba9c70
[ "MIT" ]
2
2020-11-05T20:23:29.000Z
2020-11-05T20:24:17.000Z
lib/game/include/GameRules.h
rsehmbi/social--gaming
e3c46e1029e2b1b9ee42d48a30c2bf591aba9c70
[ "MIT" ]
null
null
null
lib/game/include/GameRules.h
rsehmbi/social--gaming
e3c46e1029e2b1b9ee42d48a30c2bf591aba9c70
[ "MIT" ]
null
null
null
#ifndef GAMERULES_H #define GAMERULES_H #include "json.hpp" #include "Rule.h" #include <vector> namespace game { // This GameRules class is responsible for holding the rules for games class GameRules { public: GameRules(); void addRule(Rule& rule); // Used for testing and debugging const std::vector<Rule>& getRules(); std::string toString(); private: std::vector<Rule> rules; }; } #endif
17.666667
74
0.607966
[ "vector" ]
36246003c2dc0689d8b0f60b118c03dac5655247
9,168
h
C
classes/Coordinate.h
bmampaey/SPoCA
902f3f713c1f86263a8c27d8a3cf429b508ed596
[ "MIT" ]
null
null
null
classes/Coordinate.h
bmampaey/SPoCA
902f3f713c1f86263a8c27d8a3cf429b508ed596
[ "MIT" ]
null
null
null
classes/Coordinate.h
bmampaey/SPoCA
902f3f713c1f86263a8c27d8a3cf429b508ed596
[ "MIT" ]
null
null
null
#pragma once #ifndef CartesianCoordinate_H #define CartesianCoordinate_H #include <stdio.h> #include <limits> #include <iostream> #include <cmath> #include <vector> #include <limits> #include "constants.h" //! General Type for cartesian coordinate template<class T> class CartesianCoordinate { public : T x, y; public : //! Constructor CartesianCoordinate(const T& x = 0, const T& y = 0):x(x), y(y){}; //! Destructor virtual ~CartesianCoordinate(){}; //! Comparison operator bool operator==(const CartesianCoordinate& c)const { if(std::numeric_limits<T>::is_integer) return x == c.x && y == c.y; else return fabs(x - c.x) < std::numeric_limits<T>::epsilon() && fabs(y - c.y) < std::numeric_limits<T>::epsilon(); } CartesianCoordinate& operator-=(const CartesianCoordinate& c) { x -= c.x; y -= c.y; return *this; } CartesianCoordinate operator-(const CartesianCoordinate& c) const { CartesianCoordinate result(*this); return result-=(c); } /* //! Comparison operator bool operator!=(const CartesianCoordinate& c)const { return x != c.x || y != c.y; } //! Comparison operator bool operator<(const CartesianCoordinate& c)const { if (y < c.y) return true; else if (y > c.y) return false; else if (x < c.x) return true; else return false; } CartesianCoordinate operator*(const T& value) const { return CartesianCoordinate(x * value, y * value); } CartesianCoordinate operator/(const T& value) const { return CartesianCoordinate(x / value, y / value); } */ CartesianCoordinate& operator+=(const CartesianCoordinate& c) { x += c.x; y += c.y; return *this; } CartesianCoordinate operator+(const CartesianCoordinate& c) const { CartesianCoordinate result(*this); return result+=(c); } //! Test if coordinate is null virtual bool operator !() const { if (std::numeric_limits<T>::has_infinity) return !(std::isfinite(x) && std::isfinite(y)); else return x == std::numeric_limits<T>::max() || y == std::numeric_limits<T>::max(); } public : //! The null coordinate static const CartesianCoordinate null() { if (std::numeric_limits<T>::has_infinity) return CartesianCoordinate(std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity()); else return CartesianCoordinate(std::numeric_limits<T>::max(), std::numeric_limits<T>::max()); } }; //! Euclidian distance between 2 coordinates template <class T> Real distance(const CartesianCoordinate<T>& a, const CartesianCoordinate<T>& b); //! Square of the euclidian distance between 2 coordinates template <class T> Real distance_squared(const CartesianCoordinate<T>& a, const CartesianCoordinate<T>& b); //! Output operator template <class T> std::ostream& operator<<(std::ostream& out, const CartesianCoordinate<T>& c); //! Input operator template <class T> std::istream& operator>>(std::istream& in, CartesianCoordinate<T>& c); //! Type of the coordinate for a continuous pixel location class RealPixLoc: public CartesianCoordinate<Real> { public: //! Constructor RealPixLoc(const Real& x = 0, const Real& y = 0): CartesianCoordinate<Real>(x, y){} //! Casting from PixLoc RealPixLoc(const CartesianCoordinate<unsigned>& c) : CartesianCoordinate<Real>(c.x, c.y){} //! Casting from CartesianCoordinate explicit RealPixLoc(const CartesianCoordinate<Real>& c): CartesianCoordinate<Real>(c){} //! The null coordinate static const RealPixLoc null() { return RealPixLoc(CartesianCoordinate<Real>::null()); } //std::ostream& operator<<(std::ostream& out, const RealPixLoc& c); //std::istream& operator>>(std::istream& in, RealPixLoc& c); }; //! Type of the coordinate for a discrete pixel location class PixLoc: public CartesianCoordinate<unsigned> { public: //! Constructor PixLoc(const unsigned& x = 0, const unsigned &y = 0): CartesianCoordinate<unsigned>(x, y){} //! Casting from RealPixLoc explicit PixLoc(const RealPixLoc& c) : CartesianCoordinate<unsigned>(unsigned(c.x+0.5), unsigned(c.y+0.5)){} //! Casting from CartesianCoordinate explicit PixLoc(const CartesianCoordinate<unsigned>& c): CartesianCoordinate<unsigned>(c){} //! The null coordinate static const PixLoc null() { return PixLoc(CartesianCoordinate<unsigned>::null()); } }; //! Type of the HelioProjective cartesian coordinate, in arcsec class HPC: public CartesianCoordinate<Real> { public: //! Constructor HPC(const Real& x = 0, const Real& y = 0): CartesianCoordinate<Real>(x, y){} //! Casting from CartesianCoordinate explicit HPC(const CartesianCoordinate<Real>& c): CartesianCoordinate<Real>(c){} //! The null coordinate static const HPC null() { return HPC(CartesianCoordinate<Real>::null()); } }; //! Type of the HelioCentric cartesian coordinate, in Mmeters class HCC: public CartesianCoordinate<Real> { public: Real z; //! Constructor HCC(const Real& x = 0, const Real& y = 0, const Real& z = 0): CartesianCoordinate<Real>(x, y), z(z){} //! Casting from CartesianCoordinate explicit HCC(const CartesianCoordinate<Real>& c): CartesianCoordinate<Real>(c){} HCC& operator+=(const HCC& c) { x += c.x; y += c.y; z += c.z; return *this; } //! The null coordinate static const HCC null() { return HCC(CartesianCoordinate<Real>::null()); } }; //! Output operator std::ostream& operator<<(std::ostream& out, const HCC& c); //! Input operator std::istream& operator>>(std::istream& in, HCC& c); //! General Type for heliographic coordinate class HeliographicCoordinate { public : Real longitude, latitude; public : //! Constructor HeliographicCoordinate():longitude(0), latitude(0){}; //! Constructor HeliographicCoordinate(const Real& longitude, const Real& latitude):longitude(longitude), latitude(latitude){}; //! Destructor virtual ~HeliographicCoordinate(){}; /* //! Comparison operator bool operator==(const HeliographicCoordinate& c)const { return longitude == c.longitude && latitude == c.latitude; } //! Comparison operator bool operator!=(const HeliographicCoordinate& c)const { return longitude != c.longitude || latitude != c.latitude; } //! Comparison operator bool operator<(const HeliographicCoordinate& c)const { if(latitude < c.latitude) return true; else if (latitude == c.latitude && longitude < c.longitude) return true; else return false; } HeliographicCoordinate& operator+=(const HeliographicCoordinate& c) { longitude += c.longitude; latitude += c.latitude; return *this; } HeliographicCoordinate& operator-=(const HeliographicCoordinate& c) { longitude -= c.longitude; latitude -= c.latitude; return *this; } HeliographicCoordinate operator+(const HeliographicCoordinate& c) const { HeliographicCoordinate result(*this); return result+=(c); } HeliographicCoordinate operator-(const HeliographicCoordinate& c) const { HeliographicCoordinate result(*this); return result-=(c); } */ HeliographicCoordinate& operator+=(const HeliographicCoordinate& c) { longitude += c.longitude; latitude += c.latitude; return *this; } //! Test if coordinate is null virtual bool operator !() const { return !(std::isfinite(latitude) && std::isfinite(longitude)); } public : //! The null coordinate static const HeliographicCoordinate null() { return HeliographicCoordinate(std::numeric_limits<Real>::infinity(), std::numeric_limits<Real>::infinity()); } }; //! Distance between 2 coordinates using the Formula of Spherical Law of Cosines Real distance(const HeliographicCoordinate& a, const HeliographicCoordinate& b, const Real& R = 1); //! Square of the distance between 2 coordinates using the Formula of Spherical Law of Cosines Real distance_squared(const HeliographicCoordinate& a, const HeliographicCoordinate& b, const Real& R = 1); //! Output operator std::ostream& operator<<(std::ostream& out, const HeliographicCoordinate& c); //! Input operator std::istream& operator>>(std::istream& in, HeliographicCoordinate& c); //! Type of the Heliographic Stonyhurst coordinate, in arcsec class HGS: public HeliographicCoordinate { public: //! Constructor HGS(const Real& longitude = 0, const Real& latitude = 0): HeliographicCoordinate(longitude, latitude){} //! Casting from HeliographicCoordinate explicit HGS(const HeliographicCoordinate& c): HeliographicCoordinate(c){} //! The null coordinate static const HGS null() { return HGS(HeliographicCoordinate::null()); } }; //! Type of the Heliographic Carrington coordinate, in arcsec class HGC: public HeliographicCoordinate { public: //! Constructor HGC(const Real& longitude = 0, const Real& latitude = 0): HeliographicCoordinate(longitude, latitude){} //! Casting from HeliographicCoordinate explicit HGC(const HeliographicCoordinate& c): HeliographicCoordinate(c){} //! The null coordinate static const HGC null() { return HGC(HeliographicCoordinate::null()); } }; #endif
26.045455
114
0.69339
[ "vector" ]
362542f6f0c93e85bddf43373813bb7b330975b4
3,523
h
C
cpp/src/hypergraph.h
kazuibasou/hyper-dk-series
f47709d06285b1788cbbf7cd29480f87a2f2ccbc
[ "MIT" ]
null
null
null
cpp/src/hypergraph.h
kazuibasou/hyper-dk-series
f47709d06285b1788cbbf7cd29480f87a2f2ccbc
[ "MIT" ]
null
null
null
cpp/src/hypergraph.h
kazuibasou/hyper-dk-series
f47709d06285b1788cbbf7cd29480f87a2f2ccbc
[ "MIT" ]
null
null
null
#ifndef HYPERGRAPH_H #define HYPERGRAPH_H class HyperGraph{ public: std::vector<int> V; std::vector<int> E; std::unordered_map<int, std::vector<int>> elist; std::unordered_map<int, std::vector<int>> vlist; HyperGraph(); ~HyperGraph(); int read_hypergraph(const char *hypergraph); }; //two-dimensional property (e.g., pairwise joint degree distribution) template <typename TYPE> class Matrix{ public: std::unordered_map<int, int> key_to_ids; std::vector<int> id_to_keys; std::vector<std::vector<TYPE>> entries; Matrix(); ~Matrix(); int clear(); int entry(const int k); TYPE get(const int k, const int l) const; int set(const int k, const int l, const TYPE value); int add(const int k, const int l, const TYPE value); int subtract(const int k, const int l, const TYPE value); }; template <typename TYPE> Matrix<TYPE>::Matrix(){ key_to_ids = std::unordered_map<int, int>(); id_to_keys = std::vector<int>(); entries = std::vector<std::vector<TYPE>>(); } template <typename TYPE> Matrix<TYPE>::~Matrix(){ std::unordered_map<int, int>().swap(key_to_ids); std::vector<int>().swap(id_to_keys); std::vector<std::vector<TYPE>>().swap(entries); } template <typename TYPE> int Matrix<TYPE>::clear(){ key_to_ids.clear(); id_to_keys.clear(); entries.clear(); return 0; } template <typename TYPE> int Matrix<TYPE>::entry(const int k){ int size = int(id_to_keys.size()); id_to_keys.push_back(k); key_to_ids[k] = size; for(int i=0; i<size; ++i){ entries[i].push_back(TYPE(0)); } entries.push_back(std::vector<TYPE>(size+1, TYPE(0))); return 0; } template <typename TYPE> TYPE Matrix<TYPE>::get(const int k, const int l) const{ if(key_to_ids.find(k) == key_to_ids.end()){ return 0; } if(key_to_ids.find(l) == key_to_ids.end()){ return 0; } int i_k = key_to_ids.at(k); int i_l = key_to_ids.at(l); return entries[i_k][i_l]; } template <typename TYPE> int Matrix<TYPE>::set(const int k, const int l, const TYPE value){ if(key_to_ids.find(k) == key_to_ids.end()){ entry(k); } if(key_to_ids.find(l) == key_to_ids.end()){ entry(l); } int i_k = key_to_ids[k]; int i_l = key_to_ids[l]; entries[i_k][i_l] = value; return 0; } template <typename TYPE> int Matrix<TYPE>::add(const int k, const int l, const TYPE value){ if(key_to_ids.find(k) == key_to_ids.end()){ entry(k); } if(key_to_ids.find(l) == key_to_ids.end()){ entry(l); } int i_k = key_to_ids[k]; int i_l = key_to_ids[l]; entries[i_k][i_l] += value; return 0; } template <typename TYPE> int Matrix<TYPE>::subtract(const int k, const int l, const TYPE value){ if(key_to_ids.find(k) == key_to_ids.end()){ entry(k); } if(key_to_ids.find(l) == key_to_ids.end()){ entry(l); } int i_k = key_to_ids[k]; int i_l = key_to_ids[l]; entries[i_k][i_l] -= value; return 0; } int add_node_to_hyperedge(HyperGraph &G, const int &v, const int &m); int remove_node_from_hyperedge(HyperGraph &G, const int &v, const int &m); int calc_node_degree(HyperGraph &G, std::unordered_map<int, int> &node_degree); int calc_maximum_node_degree(HyperGraph &G, int &max_node_deg); int calc_num_jnt_node_deg(HyperGraph &G, Matrix<int> &num_jnt_node_deg); int calc_node_redundancy_coefficient(HyperGraph &G, std::unordered_map<int, double> &node_redun_coeff); int calc_degree_dependent_node_redundancy_coefficient(HyperGraph &G, std::vector<double> &degree_node_redun_coeff); int calc_hyperedge_size(HyperGraph &G, std::unordered_map<int, int> &hyperedge_size); #endif
23.177632
115
0.692592
[ "vector" ]
362818810b284bb79f4925fdfa0936a9febdd8a6
2,444
h
C
Sources/API/Core/Resources/resource_object.h
ValtoFrameworks/ClanLib
2d6b59386ce275742653b354a1daab42cab7cb3e
[ "Linux-OpenIB" ]
null
null
null
Sources/API/Core/Resources/resource_object.h
ValtoFrameworks/ClanLib
2d6b59386ce275742653b354a1daab42cab7cb3e
[ "Linux-OpenIB" ]
null
null
null
Sources/API/Core/Resources/resource_object.h
ValtoFrameworks/ClanLib
2d6b59386ce275742653b354a1daab42cab7cb3e
[ "Linux-OpenIB" ]
null
null
null
/* ** ClanLib SDK ** Copyright (c) 1997-2016 The ClanLib Team ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any damages ** arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute it ** freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** Note: Some of the libraries ClanLib may link to may have additional ** requirements or restrictions. ** ** File Author(s): ** ** Magnus Norddahl */ #pragma once #include "resource.h" namespace clan { /// \addtogroup clanCore_Resources clanCore Resources /// \{ /// \brief Resource proxy of any type class ResourceObject { public: ResourceObject() { } template<typename Type> ResourceObject(const Resource<Type> &resource) : object(resource.handle()) { } bool is_null() const { return !object; } template<typename Type> Resource<Type> cast() { if (object) { std::shared_ptr<Resource_Impl<Type> > resource = std::dynamic_pointer_cast<Resource_Impl<Type>>(object); if (!resource) throw Exception("ResourceObject type mismatch"); return Resource<Type>(resource); } else { throw Exception("ResourceObject is null"); } } bool operator<(const ResourceObject &other) const { return object < other.object; } bool operator<=(const ResourceObject &other) const { return object <= other.object; } bool operator>(const ResourceObject &other) const { return object > other.object; } bool operator>=(const ResourceObject &other) const { return object >= other.object; } bool operator==(const ResourceObject &other) const { return object == other.object; } bool operator!=(const ResourceObject &other) const { return object != other.object; } private: std::shared_ptr<Resource_BaseImpl> object; }; /// \} }
29.445783
108
0.706219
[ "object" ]
362bf525610a038dcee49de6991890387f4bfe5f
553
h
C
SharkAttack/TerreinGenerator.h
Directnix/sharkAttack
beaa3c54abb65d0b44aa145d2ad8217417272421
[ "MIT" ]
null
null
null
SharkAttack/TerreinGenerator.h
Directnix/sharkAttack
beaa3c54abb65d0b44aa145d2ad8217417272421
[ "MIT" ]
null
null
null
SharkAttack/TerreinGenerator.h
Directnix/sharkAttack
beaa3c54abb65d0b44aa145d2ad8217417272421
[ "MIT" ]
null
null
null
#ifndef TERREIN_H #define TERREIN_H #include <string> #include <vector> #include "ObjModel.h" #include "stb_image.h" class TerreinGenerator { public: TerreinGenerator(std::string, std::string); ~TerreinGenerator(); void generateHeightMap(std::string); void drawTerrein(); bool isFree(Vec2f); private: Texture* terreinTexture; Texture* waterTexture; std::vector<Vert> terreinVertices; std::vector<Vert> waterVertices; ObjModel* grasm; float waterLevel; float getHeight(int x, int y, stbi_uc * imgData, int width); }; #endif // !
15.8
61
0.730561
[ "vector" ]
362c24c4aad7850fae0aadb97e4e126670142c0b
27,242
h
C
mozilla/gfx/thebes/gfxPlatform.h
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
5
2016-12-20T15:48:05.000Z
2020-05-01T20:12:09.000Z
mozilla/gfx/thebes/gfxPlatform.h
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
null
null
null
mozilla/gfx/thebes/gfxPlatform.h
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
2
2016-12-20T15:48:13.000Z
2019-12-10T15:15:05.000Z
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GFX_PLATFORM_H #define GFX_PLATFORM_H #include "mozilla/Logging.h" #include "mozilla/gfx/Types.h" #include "nsTArray.h" #include "nsString.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "gfxTypes.h" #include "gfxFontFamilyList.h" #include "gfxBlur.h" #include "nsRect.h" #include "qcms.h" #include "mozilla/RefPtr.h" #include "GfxInfoCollector.h" #include "mozilla/layers/CompositorTypes.h" class gfxASurface; class gfxFont; class gfxFontGroup; struct gfxFontStyle; class gfxUserFontSet; class gfxFontEntry; class gfxPlatformFontList; class gfxTextRun; class nsIURI; class nsIAtom; class nsIObserver; class SRGBOverrideObserver; class gfxTextPerfMetrics; namespace mozilla { namespace gl { class SkiaGLGlue; } // namespace gl namespace gfx { class DrawTarget; class SourceSurface; class DataSourceSurface; class ScaledFont; class DrawEventRecorder; class VsyncSource; class DeviceInitData; inline uint32_t BackendTypeBit(BackendType b) { return 1 << uint8_t(b); } } // namespace gfx } // namespace mozilla #define MOZ_PERFORMANCE_WARNING(module, ...) \ do { \ if (gfxPlatform::PerfWarnings()) { \ printf_stderr("[" module "] " __VA_ARGS__); \ } \ } while (0) extern cairo_user_data_key_t kDrawTarget; enum eCMSMode { eCMSMode_Off = 0, // No color management eCMSMode_All = 1, // Color manage everything eCMSMode_TaggedOnly = 2, // Color manage tagged Images Only eCMSMode_AllCount = 3 }; enum eGfxLog { // all font enumerations, localized names, fullname/psnames, cmap loads eGfxLog_fontlist = 0, // timing info on font initialization eGfxLog_fontinit = 1, // dump text runs, font matching, system fallback for content eGfxLog_textrun = 2, // dump text runs, font matching, system fallback for chrome eGfxLog_textrunui = 3, // dump cmap coverage data as they are loaded eGfxLog_cmapdata = 4, // text perf data eGfxLog_textperf = 5 }; // when searching through pref langs, max number of pref langs const uint32_t kMaxLenPrefLangList = 32; extern bool gANGLESupportsD3D11; #define UNINITIALIZED_VALUE (-1) inline const char* GetBackendName(mozilla::gfx::BackendType aBackend) { switch (aBackend) { case mozilla::gfx::BackendType::DIRECT2D: return "direct2d"; case mozilla::gfx::BackendType::COREGRAPHICS_ACCELERATED: return "quartz accelerated"; case mozilla::gfx::BackendType::COREGRAPHICS: return "quartz"; case mozilla::gfx::BackendType::CAIRO: return "cairo"; case mozilla::gfx::BackendType::SKIA: return "skia"; case mozilla::gfx::BackendType::RECORDING: return "recording"; case mozilla::gfx::BackendType::DIRECT2D1_1: return "direct2d 1.1"; case mozilla::gfx::BackendType::NONE: return "none"; } MOZ_CRASH("Incomplete switch"); } enum class DeviceResetReason { OK = 0, HUNG, REMOVED, RESET, DRIVER_ERROR, INVALID_CALL, OUT_OF_MEMORY, FORCED_RESET, UNKNOWN }; enum class ForcedDeviceResetReason { OPENSHAREDHANDLE = 0 }; class gfxPlatform { friend class SRGBOverrideObserver; public: typedef mozilla::gfx::Color Color; typedef mozilla::gfx::DataSourceSurface DataSourceSurface; typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::IntSize IntSize; typedef mozilla::gfx::SourceSurface SourceSurface; /** * Return a pointer to the current active platform. * This is a singleton; it contains mostly convenience * functions to obtain platform-specific objects. */ static gfxPlatform *GetPlatform(); /** * Returns whether or not graphics has been initialized yet. This is * intended for Telemetry where we don't necessarily want to initialize * graphics just to observe its state. */ static bool Initialized(); /** * Shut down Thebes. * Init() arranges for this to be called at an appropriate time. */ static void Shutdown(); static void InitLayersIPC(); static void ShutdownLayersIPC(); /** * Create an offscreen surface of the given dimensions * and image format. */ virtual already_AddRefed<gfxASurface> CreateOffscreenSurface(const IntSize& aSize, gfxImageFormat aFormat) = 0; /** * Beware that these methods may return DrawTargets which are not fully supported * on the current platform and might fail silently in subtle ways. This is a massive * potential footgun. You should only use these methods for canvas drawing really. * Use extreme caution if you use them for content where you are not 100% sure we * support the DrawTarget we get back. * See SupportsAzureContentForDrawTarget. */ virtual already_AddRefed<DrawTarget> CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); virtual already_AddRefed<DrawTarget> CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); /* * Creates a SourceSurface for a gfxASurface. This function does no caching, * so the caller should cache the gfxASurface if it will be used frequently. * The returned surface keeps a reference to aTarget, so it is OK to keep the * surface, even if aTarget changes. * aTarget should not keep a reference to the returned surface because that * will cause a cycle. * * This function is static so that it can be accessed from * PluginInstanceChild (where we can't call gfxPlatform::GetPlatform() * because the prefs service can only be accessed from the main process). */ static already_AddRefed<SourceSurface> GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface); static void ClearSourceSurfaceForSurface(gfxASurface *aSurface); static already_AddRefed<DataSourceSurface> GetWrappedDataSourceSurface(gfxASurface *aSurface); virtual already_AddRefed<mozilla::gfx::ScaledFont> GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); already_AddRefed<DrawTarget> CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); already_AddRefed<DrawTarget> CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); virtual already_AddRefed<DrawTarget> CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize, int32_t aStride, mozilla::gfx::SurfaceFormat aFormat); /** * Returns true if rendering to data surfaces produces the same results as * rendering to offscreen surfaces on this platform, making it safe to * render content to data surfaces. This is generally false on platforms * which use different backends for each type of DrawTarget. */ virtual bool CanRenderContentToDataSurface() const { return false; } /** * Returns true if we should use Azure to render content with aTarget. For * example, it is possible that we are using Direct2D for rendering and thus * using Azure. But we want to render to a CairoDrawTarget, in which case * SupportsAzureContent will return true but SupportsAzureContentForDrawTarget * will return false. */ bool SupportsAzureContentForDrawTarget(mozilla::gfx::DrawTarget* aTarget); bool SupportsAzureContentForType(mozilla::gfx::BackendType aType) { return BackendTypeBit(aType) & mContentBackendBitmask; } /// This function lets us know if the current preferences/platform /// combination allows for both accelerated and not accelerated canvas /// implementations. If it does, and other relevant preferences are /// asking for it, we will examine the commands in the first few seconds /// of the canvas usage, and potentially change to accelerated or /// non-accelerated canvas. virtual bool HaveChoiceOfHWAndSWCanvas(); virtual bool UseAcceleratedSkiaCanvas(); virtual void InitializeSkiaCacheLimits(); /// These should be used instead of directly accessing the preference, /// as different platforms may override the behaviour. virtual bool UseProgressivePaint(); static bool AsyncPanZoomEnabled(); virtual void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) { aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend)); aObj.DefineProperty("AzureSkiaAccelerated", UseAcceleratedSkiaCanvas()); aObj.DefineProperty("AzureFallbackCanvasBackend", GetBackendName(mFallbackCanvasBackend)); aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend)); } void GetApzSupportInfo(mozilla::widget::InfoObject& aObj); // Get the default content backend that will be used with the default // compositor. If the compositor is known when calling this function, // GetContentBackendFor() should be called instead. mozilla::gfx::BackendType GetDefaultContentBackend() { return mContentBackend; } // Return the best content backend available that is compatible with the // given layers backend. virtual mozilla::gfx::BackendType GetContentBackendFor(mozilla::layers::LayersBackend aLayers) { return mContentBackend; } mozilla::gfx::BackendType GetPreferredCanvasBackend() { return mPreferredCanvasBackend; } mozilla::gfx::BackendType GetFallbackCanvasBackend() { return mFallbackCanvasBackend; } /* * Font bits */ virtual void SetupClusterBoundaries(gfxTextRun *aTextRun, const char16_t *aString); /** * Fill aListOfFonts with the results of querying the list of font names * that correspond to the given language group or generic font family * (or both, or neither). */ virtual nsresult GetFontList(nsIAtom *aLangGroup, const nsACString& aGenericFamily, nsTArray<nsString>& aListOfFonts); int GetTileWidth(); int GetTileHeight(); void SetTileSize(int aWidth, int aHeight); /** * Rebuilds the any cached system font lists */ virtual nsresult UpdateFontList(); /** * Create the platform font-list object (gfxPlatformFontList concrete subclass). * This function is responsible to create the appropriate subclass of * gfxPlatformFontList *and* to call its InitFontList() method. */ virtual gfxPlatformFontList *CreatePlatformFontList() { NS_NOTREACHED("oops, this platform doesn't have a gfxPlatformFontList implementation"); return nullptr; } /** * Resolving a font name to family name. The result MUST be in the result of GetFontList(). * If the name doesn't in the system, aFamilyName will be empty string, but not failed. */ virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) = 0; /** * Create the appropriate platform font group */ virtual gfxFontGroup* CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList, const gfxFontStyle *aStyle, gfxTextPerfMetrics* aTextPerf, gfxUserFontSet *aUserFontSet, gfxFloat aDevToCssSize) = 0; /** * Look up a local platform font using the full font face name. * (Needed to support @font-face src local().) * Ownership of the returned gfxFontEntry is passed to the caller, * who must either AddRef() or delete. */ virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, uint16_t aWeight, int16_t aStretch, uint8_t aStyle) { return nullptr; } /** * Activate a platform font. (Needed to support @font-face src url().) * aFontData is a NS_Malloc'ed block that must be freed by this function * (or responsibility passed on) when it is no longer needed; the caller * will NOT free it. * Ownership of the returned gfxFontEntry is passed to the caller, * who must either AddRef() or delete. */ virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, uint16_t aWeight, int16_t aStretch, uint8_t aStyle, const uint8_t* aFontData, uint32_t aLength); /** * Whether to allow downloadable fonts via @font-face rules */ bool DownloadableFontsEnabled(); /** * True when hinting should be enabled. This setting shouldn't * change per gecko process, while the process is live. If so the * results are not defined. * * NB: this bit is only honored by the FT2 backend, currently. */ virtual bool FontHintingEnabled() { return true; } /** * True when zooming should not require reflow, so glyph metrics and * positioning should not be adjusted for device pixels. * If this is TRUE, then FontHintingEnabled() should be FALSE, * but the converse is not necessarily required; in particular, * B2G always has FontHintingEnabled FALSE, but RequiresLinearZoom * is only true for the browser process, not Gaia or other apps. * * Like FontHintingEnabled (above), this setting shouldn't * change per gecko process, while the process is live. If so the * results are not defined. * * NB: this bit is only honored by the FT2 backend, currently. */ virtual bool RequiresLinearZoom() { return false; } /** * Whether to check all font cmaps during system font fallback */ bool UseCmapsDuringSystemFallback(); /** * Whether to render SVG glyphs within an OpenType font wrapper */ bool OpenTypeSVGEnabled(); /** * Max character length of words in the word cache */ uint32_t WordCacheCharLimit(); /** * Max number of entries in word cache */ uint32_t WordCacheMaxEntries(); /** * Whether to use the SIL Graphite rendering engine * (for fonts that include Graphite tables) */ bool UseGraphiteShaping(); // check whether format is supported on a platform or not (if unclear, returns true) virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) { return false; } virtual bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr) { return false; } // returns a list of commonly used fonts for a given character // these are *possible* matches, no cmap-checking is done at this level virtual void GetCommonFallbackFonts(uint32_t /*aCh*/, uint32_t /*aNextCh*/, int32_t /*aRunScript*/, nsTArray<const char*>& /*aFontList*/) { // platform-specific override, by default do nothing } // Are we in safe mode? static bool InSafeMode(); static bool OffMainThreadCompositingEnabled(); static bool CanUseDirect3D9(); static bool CanUseDirect3D11(); virtual bool CanUseHardwareVideoDecoding(); static bool CanUseDirect3D11ANGLE(); // Returns whether or not layers acceleration should be used. This should // only be called on the parent process. bool ShouldUseLayersAcceleration(); // Returns a prioritized list of all available compositor backends. void GetCompositorBackends(bool useAcceleration, nsTArray<mozilla::layers::LayersBackend>& aBackends); /** * Is it possible to use buffer rotation. Note that these * check the preference, but also allow for the override to * disable it using DisableBufferRotation. */ static bool BufferRotationEnabled(); static void DisableBufferRotation(); /** * Are we going to try color management? */ static eCMSMode GetCMSMode(); /** * Determines the rendering intent for color management. * * If the value in the pref gfx.color_management.rendering_intent is a * valid rendering intent as defined in gfx/qcms/qcms.h, that * value is returned. Otherwise, -1 is returned and the embedded intent * should be used. * * See bug 444014 for details. */ static int GetRenderingIntent(); /** * Convert a pixel using a cms transform in an endian-aware manner. * * Sets 'out' to 'in' if transform is nullptr. */ static void TransformPixel(const Color& in, Color& out, qcms_transform *transform); /** * Return the output device ICC profile. */ static qcms_profile* GetCMSOutputProfile(); /** * Return the sRGB ICC profile. */ static qcms_profile* GetCMSsRGBProfile(); /** * Return sRGB -> output device transform. */ static qcms_transform* GetCMSRGBTransform(); /** * Return output -> sRGB device transform. */ static qcms_transform* GetCMSInverseRGBTransform(); /** * Return sRGBA -> output device transform. */ static qcms_transform* GetCMSRGBATransform(); virtual void FontsPrefsChanged(const char *aPref); int32_t GetBidiNumeralOption(); static void FlushFontAndWordCaches(); /** * Returns a 1x1 surface that can be used to create graphics contexts * for measuring text etc as if they will be rendered to the screen */ gfxASurface* ScreenReferenceSurface() { return mScreenReferenceSurface; } mozilla::gfx::DrawTarget* ScreenReferenceDrawTarget() { return mScreenReferenceDrawTarget; } virtual mozilla::gfx::SurfaceFormat Optimal2DFormatForContent(gfxContentType aContent); virtual gfxImageFormat OptimalFormatForContent(gfxContentType aContent); virtual gfxImageFormat GetOffscreenFormat() { return mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32; } /** * Returns a logger if one is available and logging is enabled */ static mozilla::LogModule* GetLog(eGfxLog aWhichLog); int GetScreenDepth() const { return mScreenDepth; } mozilla::gfx::IntSize GetScreenSize() const { return mScreenSize; } /** * Return the layer debugging options to use browser-wide. */ mozilla::layers::DiagnosticTypes GetLayerDiagnosticTypes(); static mozilla::gfx::IntRect FrameCounterBounds() { int bits = 16; int sizeOfBit = 3; return mozilla::gfx::IntRect(0, 0, bits * sizeOfBit, sizeOfBit); } mozilla::gl::SkiaGLGlue* GetSkiaGLGlue(); void PurgeSkiaCache(); virtual bool IsInGonkEmulator() const { return false; } static bool UsesOffMainThreadCompositing(); bool HasEnoughTotalSystemMemoryForSkiaGL(); /** * Get the hardware vsync source for each platform. * Should only exist and be valid on the parent process */ virtual mozilla::gfx::VsyncSource* GetHardwareVsync() { MOZ_ASSERT(mVsyncSource != nullptr); MOZ_ASSERT(XRE_IsParentProcess()); return mVsyncSource; } /** * True if layout rendering should use ASAP mode, which means * the refresh driver and compositor should render ASAP. * Used for talos testing purposes */ static bool IsInLayoutAsapMode(); /** * Returns the software vsync rate to use. */ static int GetSoftwareVsyncRate(); /** * Returns whether or not a custom vsync rate is set. */ static bool ForceSoftwareVsync(); /** * Returns the default frame rate for the refresh driver / software vsync. */ static int GetDefaultFrameRate(); /** * Used to test which input types are handled via APZ. */ virtual bool SupportsApzWheelInput() const { return false; } virtual bool SupportsApzTouchInput() const { return false; } bool SupportsApzDragInput() const; virtual void FlushContentDrawing() {} // If a device reset has occurred, update the necessary platform backend // bits. virtual bool UpdateForDeviceReset() { return false; } /** * Helper method, creates a draw target for a specific Azure backend. * Used by CreateOffscreenDrawTarget. */ already_AddRefed<DrawTarget> CreateDrawTargetForBackend(mozilla::gfx::BackendType aBackend, const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); /** * Wrapper around gfxPrefs::PerfWarnings(). * Extracted into a function to avoid including gfxPrefs.h from this file. */ static bool PerfWarnings(); void NotifyCompositorCreated(mozilla::layers::LayersBackend aBackend); mozilla::layers::LayersBackend GetCompositorBackend() const { return mCompositorBackend; } // Trigger a test-driven graphics device reset. virtual void TestDeviceReset(DeviceResetReason aReason) {} // Return information on how child processes should initialize graphics // devices. Currently this is only used on Windows. virtual void GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut); // Plugin async drawing support. virtual bool SupportsPluginDirectBitmapDrawing() { return false; } // Some platforms don't support CompositorOGL in an unaccelerated OpenGL // context. These platforms should return true here. virtual bool RequiresAcceleratedGLContextForCompositorOGL() const { return false; } protected: gfxPlatform(); virtual ~gfxPlatform(); /** * Initialized hardware vsync based on each platform. */ virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource(); // Returns whether or not layers should be accelerated by default on this platform. virtual bool AccelerateLayersByDefault(); // Returns a prioritized list of available compositor backends for acceleration. virtual void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends); /** * Initialise the preferred and fallback canvas backends * aBackendBitmask specifies the backends which are acceptable to the caller. * The backend used is determined by aBackendBitmask and the order specified * by the gfx.canvas.azure.backends pref. */ void InitBackendPrefs(uint32_t aCanvasBitmask, mozilla::gfx::BackendType aCanvasDefault, uint32_t aContentBitmask, mozilla::gfx::BackendType aContentDefault); /** * If in a child process, triggers a refresh of device preferences. */ void UpdateDeviceInitData(); /** * Called when new device preferences are available. */ virtual void SetDeviceInitData(mozilla::gfx::DeviceInitData& aData) {} /** * returns the first backend named in the pref gfx.canvas.azure.backends * which is a component of aBackendBitmask, a bitmask of backend types */ static mozilla::gfx::BackendType GetCanvasBackendPref(uint32_t aBackendBitmask); /** * returns the first backend named in the pref gfx.content.azure.backend * which is a component of aBackendBitmask, a bitmask of backend types */ static mozilla::gfx::BackendType GetContentBackendPref(uint32_t &aBackendBitmask); /** * Will return the first backend named in aBackendPrefName * allowed by aBackendBitmask, a bitmask of backend types. * It also modifies aBackendBitmask to only include backends that are * allowed given the prefs. */ static mozilla::gfx::BackendType GetBackendPref(const char* aBackendPrefName, uint32_t &aBackendBitmask); /** * Decode the backend enumberation from a string. */ static mozilla::gfx::BackendType BackendTypeForName(const nsCString& aName); static already_AddRefed<mozilla::gfx::ScaledFont> GetScaledFontForFontWithCairoSkia(mozilla::gfx::DrawTarget* aTarget, gfxFont* aFont); int8_t mAllowDownloadableFonts; int8_t mGraphiteShapingEnabled; int8_t mOpenTypeSVGEnabled; int8_t mBidiNumeralOption; // whether to always search font cmaps globally // when doing system font fallback int8_t mFallbackUsesCmaps; // max character limit for words in word cache int32_t mWordCacheCharLimit; // max number of entries in word cache int32_t mWordCacheMaxEntries; uint32_t mTotalSystemMemory; // Hardware vsync source. Only valid on parent process RefPtr<mozilla::gfx::VsyncSource> mVsyncSource; RefPtr<mozilla::gfx::DrawTarget> mScreenReferenceDrawTarget; private: /** * Start up Thebes. */ static void Init(); static void CreateCMSOutputProfile(); static void GetCMSOutputProfileData(void *&mem, size_t &size); friend void RecordingPrefChanged(const char *aPrefName, void *aClosure); virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size); /** * Calling this function will compute and set the ideal tile size for the * platform. This will only have an effect in the parent process; child processes * should be updated via SetTileSize to match the value computed in the parent. */ void ComputeTileSize(); /** * This uses nsIScreenManager to determine the screen size and color depth */ void PopulateScreenInfo(); RefPtr<gfxASurface> mScreenReferenceSurface; nsCOMPtr<nsIObserver> mSRGBOverrideObserver; nsCOMPtr<nsIObserver> mFontPrefsObserver; nsCOMPtr<nsIObserver> mMemoryPressureObserver; // The preferred draw target backend to use for canvas mozilla::gfx::BackendType mPreferredCanvasBackend; // The fallback draw target backend to use for canvas, if the preferred backend fails mozilla::gfx::BackendType mFallbackCanvasBackend; // The backend to use for content mozilla::gfx::BackendType mContentBackend; // Bitmask of backend types we can use to render content uint32_t mContentBackendBitmask; int mTileWidth; int mTileHeight; mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureCanvasBackendCollector; mozilla::widget::GfxInfoCollector<gfxPlatform> mApzSupportCollector; RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder; RefPtr<mozilla::gl::SkiaGLGlue> mSkiaGlue; // Backend that we are compositing with. NONE, if no compositor has been // created yet. mozilla::layers::LayersBackend mCompositorBackend; int32_t mScreenDepth; mozilla::gfx::IntSize mScreenSize; }; #endif /* GFX_PLATFORM_H */
33.92528
112
0.685229
[ "render", "object", "transform" ]
362d39b81eff96a4d1472a2253711c78e0960a85
1,571
h
C
easy2d/src/object/component/e2d_texture_component.h
xiyoo0812/easy2d
4edf9683de603d7f8c9474f0923001b8de48429f
[ "MIT" ]
3
2021-05-25T01:51:11.000Z
2021-08-09T02:06:59.000Z
easy2d/src/object/component/e2d_texture_component.h
xiyoo0812/easy2d
4edf9683de603d7f8c9474f0923001b8de48429f
[ "MIT" ]
null
null
null
easy2d/src/object/component/e2d_texture_component.h
xiyoo0812/easy2d
4edf9683de603d7f8c9474f0923001b8de48429f
[ "MIT" ]
null
null
null
#ifndef TEXTURE_COMPONENT_H #define TEXTURE_COMPONENT_H #include "base/e2d_color.h" #include "object/e2d_component.h" #include "graphics/e2d_texture2d.h" #include "graphics/e2d_render_object.h" namespace Easy2D { class TextureComponent : public Component { public: TextureComponent(); virtual ~TextureComponent(); virtual bool setup(SPtr<Entity> master); virtual void update(const uint32& escapeMs); virtual void onHandleEvent(SPtr<Event> event); void setColor(const Color& color); const Color& getColor() const; void setHUDEnabled(bool enabled); bool isHUDEnabled() const; bool isScale9Tile() const; void disableScale9Tile(); const Vec4& getScale9Tile() const; void setScale9Tile(const Vec4& tiles); void setScale9Tile(const float32 beginX, float32 beginY, float32 endX, float32 endY); void setUVCoords(const Vec4& coords); void setUVCoords(float32 beginX, float32 beginY, float32 endX, float32 endY); void setTexture(SPtr<Texture2D> mTexture); protected: SPtr<RenderTexture> buildRenderTexture(const Vec4& uvCoords); private: bool mScale9Enable = false; Vec4 mUvCoords{ 0, 0, 1, 1 }; Vec4 mScale9Tile{ 0, 0, 0, 0 }; SPtr<Texture2D> mTexture = nullptr; SPtr<RenderTexture> mRenderTex = nullptr; Vector<SPtr<RenderTexture>> mRenderTexScale9 = {}; public: inline static String GUID = "render_texture"; }; } #endif
24.169231
93
0.657543
[ "object", "vector" ]
362edecee6063cd993263301e9b9d83fab7a3b2d
6,684
h
C
chrome/browser/history/thumbnail_database.h
rwatson/chromium-capsicum
b03da8e897f897c6ad2cda03ceda217b760fd528
[ "BSD-3-Clause" ]
11
2015-03-20T04:08:08.000Z
2021-11-15T15:51:36.000Z
chrome/browser/history/thumbnail_database.h
rwatson/chromium-capsicum
b03da8e897f897c6ad2cda03ceda217b760fd528
[ "BSD-3-Clause" ]
null
null
null
chrome/browser/history/thumbnail_database.h
rwatson/chromium-capsicum
b03da8e897f897c6ad2cda03ceda217b760fd528
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ #define CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ #include <vector> #include "app/sql/connection.h" #include "app/sql/init_status.h" #include "app/sql/meta_table.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/history/url_database.h" // For DBCloseScoper. #include "chrome/browser/meta_table_helper.h" class FilePath; struct ThumbnailScore; class SkBitmap; namespace base { class Time; } namespace history { class ExpireHistoryBackend; class HistoryPublisher; // This database interface is owned by the history backend and runs on the // history thread. It is a totally separate component from history partially // because we may want to move it to its own thread in the future. The // operations we will do on this database will be slow, but we can tolerate // higher latency (it's OK for thumbnails to come in slower than the rest // of the data). Moving this to a separate thread would not block potentially // higher priority history operations. class ThumbnailDatabase { public: ThumbnailDatabase(); ~ThumbnailDatabase(); // Must be called after creation but before any other methods are called. // When not INIT_OK, no other functions should be called. sql::InitStatus Init(const FilePath& db_name, const HistoryPublisher* history_publisher); // Transactions on the database. void BeginTransaction(); void CommitTransaction(); int transaction_nesting() const { return db_.transaction_nesting(); } // Vacuums the database. This will cause sqlite to defragment and collect // unused space in the file. It can be VERY SLOW. void Vacuum(); // Thumbnails ---------------------------------------------------------------- // Sets the given data to be the thumbnail for the given URL, // overwriting any previous data. If the SkBitmap contains no pixel // data, the thumbnail will be deleted. void SetPageThumbnail(const GURL& url, URLID id, const SkBitmap& thumbnail, const ThumbnailScore& score, base::Time time); // Retrieves thumbnail data for the given URL, returning true on success, // false if there is no such thumbnail or there was some other error. bool GetPageThumbnail(URLID id, std::vector<unsigned char>* data); // Delete the thumbnail with the provided id. Returns false on failure bool DeleteThumbnail(URLID id); // If there is a thumbnail score for the id provided, retrieves the // current thumbnail score and places it in |score| and returns // true. Returns false otherwise. bool ThumbnailScoreForId(URLID id, ThumbnailScore* score); // Called by the to delete all old thumbnails and make a clean table. // Returns true on success. bool RecreateThumbnailTable(); // FavIcons ------------------------------------------------------------------ // Sets the bits for a favicon. This should be png encoded data. // The time indicates the access time, and is used to detect when the favicon // should be refreshed. bool SetFavIcon(FavIconID icon_id, const std::vector<unsigned char>& icon_data, base::Time time); // Sets the time the favicon was last updated. bool SetFavIconLastUpdateTime(FavIconID icon_id, base::Time time); // Returns the id of the entry in the favicon database with the specified url. // Returns 0 if no entry exists for the specified url. FavIconID GetFavIconIDForFavIconURL(const GURL& icon_url); // Gets the png encoded favicon and last updated time for the specified // favicon id. bool GetFavIcon(FavIconID icon_id, base::Time* last_updated, std::vector<unsigned char>* png_icon_data, GURL* icon_url); // Adds the favicon URL to the favicon db, returning its id. FavIconID AddFavIcon(const GURL& icon_url); // Delete the favicon with the provided id. Returns false on failure bool DeleteFavIcon(FavIconID id); // Temporary FavIcons -------------------------------------------------------- // Create a temporary table to store favicons. Favicons will be copied to // this table by CopyToTemporaryFavIconTable() and then the original table // will be dropped, leaving only those copied favicons remaining. This is // used to quickly delete most of the favicons when clearing history. bool InitTemporaryFavIconsTable() { return InitFavIconsTable(true); } // Copies the given favicon from the "main" favicon table to the temporary // one. This is only valid in between calls to InitTemporaryFavIconsTable() // and CommitTemporaryFavIconTable(). // // The ID of the favicon will change when this copy takes place. The new ID // is returned, or 0 on failure. FavIconID CopyToTemporaryFavIconTable(FavIconID source); // Replaces the main URL table with the temporary table created by // InitTemporaryFavIconsTable(). This will mean all favicons not copied over // will be deleted. Returns true on success. bool CommitTemporaryFavIconTable(); private: friend class ExpireHistoryBackend; // Creates the thumbnail table, returning true if the table already exists // or was successfully created. bool InitThumbnailTable(); // Creates the favicon table, returning true if the table already exists, // or was successfully created. is_temporary will be false when generating // the "regular" favicons table. The expirer sets this to true to generate the // temporary table, which will have a different name but the same schema. bool InitFavIconsTable(bool is_temporary); // Adds support for the new metadata on web page thumbnails. bool UpgradeToVersion3(); // Creates the index over the favicon table. This will be called during // initialization after the table is created. This is a separate function // because it is used by SwapFaviconTables to create an index over the // newly-renamed favicons table (formerly the temporary table with no index). void InitFavIconsIndex(); sql::Connection db_; sql::MetaTable meta_table_; // This object is created and managed by the history backend. We maintain an // opaque pointer to the object for our use. // This can be NULL if there are no indexers registered to receive indexing // data from us. const HistoryPublisher* history_publisher_; }; } // namespace history #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_
38.860465
80
0.712148
[ "object", "vector" ]
36358bd592bd1a430397f62aaf4e345d6eb5f251
2,443
h
C
Examples/Rigidbody.h
RizzlaPlus/Vortex2D
88545834444262d101c5686bd70d125bff2654d9
[ "MIT" ]
103
2016-05-05T17:44:01.000Z
2022-03-15T20:36:25.000Z
Examples/Rigidbody.h
RizzlaPlus/Vortex2D
88545834444262d101c5686bd70d125bff2654d9
[ "MIT" ]
22
2018-02-26T10:13:19.000Z
2021-05-03T20:55:13.000Z
Examples/Rigidbody.h
RizzlaPlus/Vortex2D
88545834444262d101c5686bd70d125bff2654d9
[ "MIT" ]
13
2017-01-08T15:31:50.000Z
2021-10-19T11:40:14.000Z
// // Rigidbody.h // Vortex // #pragma once #include <glm/trigonometric.hpp> #include <Box2D/Box2D.h> #include <Vortex/Engine/Boundaries.h> #include <Vortex/Engine/Rigidbody.h> #include <Vortex/Engine/World.h> class Box2DSolver : public Vortex::Fluid::RigidBodySolver { public: Box2DSolver(b2World& world); void Step(float delta) override; private: b2World& mWorld; }; class Box2DRigidbody : public Vortex::Fluid::RigidBody { public: Box2DRigidbody(Vortex::Renderer::Device& device, const glm::ivec2& size, Vortex::Renderer::DrawablePtr drawable, Vortex::Fluid::RigidBody::Type type); void ApplyForces(); void ApplyVelocities(); void SetTransform(const glm::vec2& pos, float angle); b2Body* mBody; }; class PolygonRigidbody { public: PolygonRigidbody(Vortex::Renderer::Device& device, const glm::ivec2& size, b2World& rWorld, b2BodyType rType, Vortex::Fluid::RigidBody::Type type, const std::vector<glm::vec2>& points, float density = 1.0f); std::shared_ptr<Vortex::Fluid::Polygon> mPolygon; Box2DRigidbody mRigidbody; }; class RectangleRigidbody : public PolygonRigidbody { public: RectangleRigidbody(Vortex::Renderer::Device& device, const glm::ivec2& size, b2World& rWorld, b2BodyType rType, Vortex::Fluid::RigidBody::Type type, const glm::vec2& halfSize, float density = 1.0f) : PolygonRigidbody(device, size, rWorld, rType, type, {{-halfSize.x, -halfSize.y}, {halfSize.x, -halfSize.y}, {halfSize.x, halfSize.y}, {-halfSize.x, halfSize.y}}, density) { } }; class CircleRigidbody { public: CircleRigidbody(Vortex::Renderer::Device& device, const glm::ivec2& size, b2World& rWorld, b2BodyType rType, Vortex::Fluid::RigidBody::Type type, const float radius, float density = 1.0f); std::shared_ptr<Vortex::Fluid::Circle> mCircle; Box2DRigidbody mRigidbody; };
25.989362
57
0.54605
[ "vector" ]
363f05bb8de3087779a00964209ce5db52ba1714
2,678
h
C
RobotsideApp-master/app/src/main/jni/floor_object_detection/floor_object_detection.h
rhickman/cellbots3
0f6bc0724ec3c83e57bbd5b103c80930425f5cee
[ "Apache-2.0" ]
8
2020-09-20T04:44:23.000Z
2020-12-19T02:48:53.000Z
RobotsideApp-master/app/src/main/jni/floor_object_detection/floor_object_detection.h
rhickman/cellbots3
0f6bc0724ec3c83e57bbd5b103c80930425f5cee
[ "Apache-2.0" ]
4
2020-09-21T00:26:08.000Z
2020-09-21T00:35:23.000Z
RobotsideApp-master/app/src/main/jni/floor_object_detection/floor_object_detection.h
rhickman/cellbots3
0f6bc0724ec3c83e57bbd5b103c80930425f5cee
[ "Apache-2.0" ]
1
2020-12-28T11:10:27.000Z
2020-12-28T11:10:27.000Z
#ifndef FLOOR_OBJECT_DETECTOR_H_ #define FLOOR_OBJECT_DETECTOR_H_ #include <vector> #include <android/log.h> #include <assert.h> #include <jni.h> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #define LOGV(...) \ __android_log_print(ANDROID_LOG_VERBOSE, "floor_object_detection", __VA_ARGS__) #define LOGD(...) \ __android_log_print(ANDROID_LOG_DEBUG, "floor_object_detection", __VA_ARGS__) #define LOGI(...) \ __android_log_print(ANDROID_LOG_INFO, "floor_object_detection", __VA_ARGS__) #define LOGW(...) \ __android_log_print(ANDROID_LOG_WARN, "floor_object_detection", __VA_ARGS__) #define LOGE(...) \ __android_log_print(ANDROID_LOG_ERROR, "floor_object_detection", __VA_ARGS__) namespace floor_object_detection { class FloorObjectDetector { public: /** Returns a pointer to a float array of the bounding rectangles of floor objects represented as: * [# of bouding boxes, tl_X_1, tl_Y_1, br_X_1, br_Y_1, depth_1, tl_X_2, tl_Y_2, br_X_2, br_Y_2, depth_2, ..] * where tl_X_i and tl_Y_i are the top left corner coordinates of rectangle i in the current world coordinates * br_X_i and br_Y_i are the bottom right coordinates of rectangle i in the current world coordinates * depth_i is the minimum non-zero depth of rectangle i * @param timestamp The timestamp that the color image was taken at. * @param depth_data The depth data to be processed. * @param image_data The YCRCB_420_SP color image. * @param image_width The width of the image. * @param image_height The width of the image. * @param color_to_depth_ratio The ratio of color image width (or height) to depth image width (or height) * This value is always greater or equal to 1 * If this value is 2, then the depth image size is (image_width/2, image_height/2) * @return a pointer to the float array of bounding boxes information * The return value can be nullptr if the data is received at a higher frequency than the set fps * (see kProcessImagesFPS in floor_object_detection.cc) * It can also be nullptr if the algorithm could not find enough points to estimate a floor plane */ float* ProcessDepthAndColorImages(double timestamp, float* depth_data, uint8_t* image_data, int image_width, int image_height, int color_to_depth_ratio); private: void ConvertYCbCrtoRGB(uint8_t* rgb, uint8_t* ycbcr, int width, int height); double prev_image_timestamp_ = 0; }; } // namespace floor object detection #endif // CPP_FLOOR_OBJECT_DETECTION_APPLICATION_H_
46.982456
113
0.747199
[ "object", "vector" ]
363f1caba0825946fb33057695b4f037cfc1aad0
638
h
C
Proyecto/ClientGame.h
LiyliLee/PracticaRVR
7e5664bc9905aeae6ca0f7245ab69cfe0cfcacdd
[ "MIT" ]
null
null
null
Proyecto/ClientGame.h
LiyliLee/PracticaRVR
7e5664bc9905aeae6ca0f7245ab69cfe0cfcacdd
[ "MIT" ]
null
null
null
Proyecto/ClientGame.h
LiyliLee/PracticaRVR
7e5664bc9905aeae6ca0f7245ab69cfe0cfcacdd
[ "MIT" ]
null
null
null
#include "SDLApp.h" #include "jugador.h" #include "ObjectInfo.h" #include <map> #include "Socket.h" #define WINDOW_WIDTH 600 #define WINDOW_HEIGHT 400 class ClientGame { private: Jugador *PlayerSelf = nullptr; std::map<std::string, ObjectInfo> jugadores; std::map<std::string, ObjectInfo> balas; SDLApp *app = nullptr; SDLTexture *background = nullptr; Socket socket; bool isRunning = true; public: ClientGame(const char *s, const char *p, const char *n); ~ClientGame(); void render() const; void initGame(); void net_thread(); void input_thread(); void run(); };
19.333333
60
0.652038
[ "render" ]
3642dd107f36ea3d152c968063228e8b0529570f
3,936
h
C
tools/OntoShell/parserconsole.h
FunctionLab/sleipnir
6f74986ef03cb2df8deee1077ae180391557403a
[ "CC-BY-3.0" ]
1
2021-03-21T23:17:12.000Z
2021-03-21T23:17:12.000Z
tools/OntoShell/parserconsole.h
FunctionLab/sleipnir
6f74986ef03cb2df8deee1077ae180391557403a
[ "CC-BY-3.0" ]
4
2021-03-26T13:56:59.000Z
2022-03-30T21:38:06.000Z
tools/OntoShell/parserconsole.h
FunctionLab/sleipnir
6f74986ef03cb2df8deee1077ae180391557403a
[ "CC-BY-3.0" ]
null
null
null
/***************************************************************************** * This file is provided under the Creative Commons Attribution 3.0 license. * * You are free to share, copy, distribute, transmit, or adapt this work * PROVIDED THAT you attribute the work to the authors listed below. * For more information, please see the following web page: * http://creativecommons.org/licenses/by/3.0/ * * This file is a component of the Sleipnir library for functional genomics, * authored by: * Curtis Huttenhower (chuttenh@princeton.edu) * Mark Schroeder * Maria D. Chikina * Olga G. Troyanskaya (ogt@princeton.edu, primary contact) * * If you use this library, the included executable tools, or any related * code in your work, please cite the following publication: * Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and * Olga G. Troyanskaya. * "The Sleipnir library for computational functional genomics" *****************************************************************************/ #ifndef PARSERCONSOLE_H #define PARSERCONSOLE_H #include "parser.h" class CParserConsole : public CParser { public: CParserConsole(const Sleipnir::IOntology **, const Sleipnir::CGenome &); bool ProcessLine(const char *); SLocation GetLocation(const string & = c_szDot, bool = true) const; protected: typedef bool (CParserConsole::*TPFnParser)(const vector <string> &); struct SArgs { static const char *c_aszFlags[]; bool m_afFlags[7]; bool &m_fGenes; bool &m_fLong; bool &m_fSibs; bool &m_fZeroes; bool &m_fBonferroni; bool &m_fRecursive; bool &m_fBackground; SArgs(); bool Parse(const string &); }; static const size_t c_iWidthGenes = 5; static const size_t c_iWidthID = 19; static const size_t c_iWidthGloss = 43; static const size_t c_iWidthOnto = 32; static const size_t c_iWidthP = 14; static const size_t c_iWidthScreen = 80; static const size_t c_iSizeCutoff = 40; static const char c_cSemicolon = ';'; static const char c_cShell = '!'; static const char c_szDotDotDot[]; static const char c_szBackground[]; static const char c_szBonferroni[]; static const char c_szGenes[]; static const char c_szLong[]; static const char c_szRecursive[]; static const char c_szSibs[]; static const char c_szStar[]; static const char c_szZeroes[]; static const char c_szHelpHelp[]; static const TPFnParser c_apfnParsers[]; static const char *c_aszHelps[]; static void PrintLink(const Sleipnir::IOntology *, size_t, char, const SArgs &); static void PrintNumber(size_t, size_t); static void PrintSpaces(size_t); static void PrintAnnotation(const Sleipnir::IOntology *, size_t, const SArgs &, const Sleipnir::STermFound * = NULL); static void PrintGloss(string, size_t, bool); static void PrintGene(const Sleipnir::CGene &, const SArgs &); static void PrintGenes(const std::vector<const Sleipnir::CGene *> &, size_t = 0, const Sleipnir::CGenes * = NULL); static size_t FormatGenes(const std::vector<const Sleipnir::CGene *> &, std::vector <string> &, const Sleipnir::CGenes * = NULL); bool ParseCat(const std::vector <string> &); bool ParseCd(const std::vector <string> &); bool ParseHelp(const std::vector <string> &); bool ParseLs(const std::vector <string> &); bool ParseFind(const std::vector <string> &); bool ParseParentage(const std::vector <string> &); bool ParseShell(const string &) const; void PrintOntology(const Sleipnir::IOntology *, char) const; void PrintLocations(const std::vector <SLocation> &, const SArgs &) const; void PrintGenes(const std::vector <SLocation> &, const SArgs &) const; SLocation m_sLocation; }; #endif // PARSERCONSOLE_H
32.8
99
0.655742
[ "vector" ]
21ff41d9d5ac61eb61ea30dadda1bac8173fef52
7,980
c
C
sdk-6.5.20/libs/sdklt/bcmlta/bcmltx/bcm56880_a0/bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/libs/sdklt/bcmlta/bcmltx/bcm56880_a0/bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/libs/sdklt/bcmlta/bcmltx/bcm56880_a0/bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
/******************************************************************************* * * DO NOT EDIT THIS FILE! * This file is auto-generated by fltg from Logical Table mapping files. * * Tool: $SDK/INTERNAL/fltg/bin/fltg * * Edits to this file will be lost when it is regenerated. * * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. * * Copyright 2007-2020 Broadcom Inc. All rights reserved. */ /* Logical Table Adaptor for component bcmltx */ /* Handler: bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler */ #include <bcmlrd/bcmlrd_types.h> #include <bcmltd/chip/bcmltd_id.h> #include <bcmltx/bcmlb/bcmltx_lb_ecmp_hash_table_select.h> #include <bcmdrd/chip/bcm56880_a0_enum.h> #include <bcmlrd/chip/bcm56880_a0/bcm56880_a0_lrd_xfrm_field_desc.h> extern const bcmltd_field_desc_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_src_field_desc_s0[]; extern const bcmltd_field_desc_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_src_field_desc_s1[]; extern const bcmltd_field_desc_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_dst_field_desc_d0[]; extern const bcmltd_field_desc_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_dst_field_desc_d0[]; static const bcmltd_field_list_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_src_list_s0 = { .field_num = 2, .field_array = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_src_field_desc_s0 }; static const bcmltd_field_list_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_src_list_s1 = { .field_num = 2, .field_array = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_src_field_desc_s1 }; static const bcmltd_field_list_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_dst_list_d0 = { .field_num = 2, .field_array = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_dst_field_desc_d0 }; static const bcmltd_field_list_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_dst_list_d0 = { .field_num = 2, .field_array = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_dst_field_desc_d0 }; static const uint32_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_transform_src_s0[2] = { LB_HASH_ECMP_LEVEL0_OUTPUT_SELECTIONt_LB_HASH_ECMP_LEVEL0_OUTPUT_SELECTION_IDf, LB_HASH_ECMP_LEVEL0_OUTPUT_SELECTIONt_LB_HASH_TABLE_INSTANCEf, }; static const uint32_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_transform_src_s1[2] = { LB_HASH_ECMP_LEVEL1_OUTPUT_SELECTIONt_LB_HASH_ECMP_LEVEL1_OUTPUT_SELECTION_IDf, LB_HASH_ECMP_LEVEL1_OUTPUT_SELECTIONt_LB_HASH_TABLE_INSTANCEf, }; static const uint32_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_transform_dst_d0[2] = { BCMLRD_FIELD_INDEX, BCMLRD_FIELD_TABLE_SEL, }; static const uint32_t bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_transform_dst_d0[2] = { BCMLRD_FIELD_INDEX, BCMLRD_FIELD_TABLE_SEL, }; static const bcmltd_generic_arg_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_comp_data = { .sid = LB_HASH_ECMP_LEVEL0_OUTPUT_SELECTIONt, .values = 0, .value = NULL, .user_data = NULL }; static const bcmltd_generic_arg_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_comp_data1 = { .sid = LB_HASH_ECMP_LEVEL1_OUTPUT_SELECTIONt, .values = 0, .value = NULL, .user_data = NULL }; static const bcmltd_transform_arg_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_fwd_arg_s0_d0_t0 = { .values = 0, .value = NULL, .tables = 2, .table = bcm56880_a0_lrd_lb_ecmp_hash_table_select_transform_tbl_t0, .fields = 2, .field = bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_transform_src_s0, .field_list = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_src_list_s0, .rfields = 2, .rfield = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_transform_dst_d0, .rfield_list = &bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_dst_list_d0, .comp_data = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_comp_data }; static const bcmltd_transform_arg_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_rev_arg_s0_d0_t0 = { .values = 0, .value = NULL, .tables = 2, .table = bcm56880_a0_lrd_lb_ecmp_hash_table_select_transform_tbl_t0, .fields = 2, .field = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_transform_dst_d0, .field_list = &bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level0_output_selection_dst_list_d0, .rfields = 2, .rfield = bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_transform_src_s0, .rfield_list = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_src_list_s0, .comp_data = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_comp_data }; static const bcmltd_transform_arg_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_fwd_arg_s1_d0_t1 = { .values = 0, .value = NULL, .tables = 2, .table = bcm56880_a0_lrd_lb_ecmp_hash_table_select_transform_tbl_t1, .fields = 2, .field = bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_transform_src_s1, .field_list = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_src_list_s1, .rfields = 2, .rfield = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_transform_dst_d0, .rfield_list = &bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_dst_list_d0, .comp_data = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_comp_data1 }; static const bcmltd_transform_arg_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_rev_arg_s1_d0_t1 = { .values = 0, .value = NULL, .tables = 2, .table = bcm56880_a0_lrd_lb_ecmp_hash_table_select_transform_tbl_t1, .fields = 2, .field = bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_transform_dst_d0, .field_list = &bcm56880_a0_lrd_bcmltx_lb_ecmp_hash_table_select_lb_hash_ecmp_level1_output_selection_dst_list_d0, .rfields = 2, .rfield = bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_transform_src_s1, .rfield_list = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_src_list_s1, .comp_data = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_comp_data1 }; const bcmltd_xfrm_handler_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_fwd_s0_d0_t0 = { .transform = bcmltx_lb_ecmp_hash_table_select_transform, .arg = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_fwd_arg_s0_d0_t0 }; const bcmltd_xfrm_handler_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_fwd_s1_d0_t1 = { .transform = bcmltx_lb_ecmp_hash_table_select_transform, .arg = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_fwd_arg_s1_d0_t1 }; const bcmltd_xfrm_handler_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_rev_s0_d0_t0 = { .transform = bcmltx_lb_ecmp_hash_table_select_rev_transform, .arg = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_rev_arg_s0_d0_t0 }; const bcmltd_xfrm_handler_t bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_rev_s1_d0_t1 = { .transform = bcmltx_lb_ecmp_hash_table_select_rev_transform, .arg = &bcm56880_a0_lta_bcmltx_lb_ecmp_hash_table_select_xfrm_handler_rev_arg_s1_d0_t1 };
43.135135
134
0.812406
[ "transform" ]
1d044242df8b11ad6d948c4cdac84e71782ca798
944
h
C
Source/Utility/MythForest/Component/Widget/WidgetComponent.h
paintdream/PaintsNow
52e14de651b56c100caac0ce2b14348441543e1a
[ "MIT" ]
15
2016-09-17T16:29:42.000Z
2021-11-24T06:21:27.000Z
Source/Utility/MythForest/Component/Widget/WidgetComponent.h
paintdream/PaintsNow
52e14de651b56c100caac0ce2b14348441543e1a
[ "MIT" ]
null
null
null
Source/Utility/MythForest/Component/Widget/WidgetComponent.h
paintdream/PaintsNow
52e14de651b56c100caac0ce2b14348441543e1a
[ "MIT" ]
3
2017-04-07T13:33:57.000Z
2021-03-31T02:04:48.000Z
// WidgetComponent.h // PaintDream (paintdream@paintdream.com) // 2018-1-19 // #pragma once #include "../../Entity.h" #include "../Model/ModelComponent.h" namespace PaintsNow { class WidgetComponent : public TAllocatedTiny<WidgetComponent, ModelComponent> { public: enum { WIDGETCOMPONENT_TEXTURE_REPEATABLE = MODELCOMPONENT_CUSTOM_BEGIN, WIDGETCOMPONENT_CUSTOM_BEGIN = MODELCOMPONENT_CUSTOM_BEGIN << 1 }; WidgetComponent(const TShared<MeshResource>& meshResource, const TShared<BatchComponent>& batchUniforms, const TShared<BatchComponent>& batchInstancedData); void GenerateDrawCalls(std::vector<OutputRenderData>& drawCallTemplates, std::vector<std::pair<uint32_t, TShared<MaterialResource> > >& materialResources) override; // Custom data Float4 inTexCoordRect; Float4 outTexCoordRect; TShared<TextureResource> mainTexture; TShared<BatchComponent> batchInstancedDataComponent; }; }
33.714286
167
0.764831
[ "vector", "model" ]
1d109d388fb86bde0df331ff1e480d7d6af87181
738
h
C
node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/Headers/TKView.h
edmundocorona/my-drawer-ng
39546f64f59940253c88e8d039b167dedea2fe12
[ "Apache-2.0" ]
11
2020-07-23T10:16:18.000Z
2022-03-09T15:36:39.000Z
node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/Headers/TKView.h
edmundocorona/my-drawer-ng
39546f64f59940253c88e8d039b167dedea2fe12
[ "Apache-2.0" ]
7
2020-08-11T08:32:31.000Z
2022-02-27T05:26:33.000Z
node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/Headers/TKView.h
edmundocorona/my-drawer-ng
39546f64f59940253c88e8d039b167dedea2fe12
[ "Apache-2.0" ]
3
2021-05-25T08:25:11.000Z
2022-03-31T22:14:15.000Z
// // TKView.h // TelerikUI // // Copyright (c) 2013 Telerik. All rights reserved. // @class TKFill; @class TKStroke; @class TKShape; @protocol TKCoreLayout; /** UIView subclass which provides custom fill, stroke and layout information */ @interface TKView : UIView /** Returns the version */ + (NSString*)versionString; /** The view's fill */ @property (nonatomic, strong) TKFill *fill; /** The view's stroke */ @property (nonatomic, strong) TKStroke *stroke; /** The view's layout */ @property (nonatomic, strong) id<TKCoreLayout> layout; /** The view's shape */ @property (nonatomic, strong) TKShape *shape; /** Array containing drawables for TKView */ @property (nonatomic, strong) NSArray *drawables; @end
14.76
74
0.688347
[ "shape" ]
1d158db2810adac2a0e8eb718b65939a2239978b
1,309
h
C
modules/actors/yato/actors/private/pinned_executor.h
agruzdev/Yato
9b5a49f6ec4169b67b9e5ffd11fdae9c238b0a3d
[ "Apache-2.0" ]
9
2020-04-16T10:43:09.000Z
2022-03-07T04:31:52.000Z
modules/actors/yato/actors/private/pinned_executor.h
agruzdev/Yato
9b5a49f6ec4169b67b9e5ffd11fdae9c238b0a3d
[ "Apache-2.0" ]
3
2020-04-16T10:51:31.000Z
2021-09-02T19:37:26.000Z
modules/actors/yato/actors/private/pinned_executor.h
agruzdev/Yato
9b5a49f6ec4169b67b9e5ffd11fdae9c238b0a3d
[ "Apache-2.0" ]
null
null
null
/** * YATO library * * Apache License, Version 2.0 * Copyright (c) 2016-2020 Alexey Gruzdev */ #ifndef _YATO_ACTORS_PINNED_EXECUTOR_H_ #define _YATO_ACTORS_PINNED_EXECUTOR_H_ #include <vector> #include <thread> #include <future> #include "abstract_executor.h" namespace yato { namespace actors { struct thread_context; class actor_system; /** * Simplest thread pool. * Creates a new thread for the each mailbox */ class pinned_executor : public abstract_executor { private: actor_system* m_system; std::vector<std::thread> m_threads; logger_ptr m_logger; uint32_t m_threads_limit; static void pinned_thread_function(pinned_executor* executor, const std::shared_ptr<mailbox> & mbox) noexcept; public: pinned_executor(actor_system* system, uint32_t max_threads); ~pinned_executor(); pinned_executor(const pinned_executor&) = delete; pinned_executor& operator=(const pinned_executor&) = delete; pinned_executor(pinned_executor&&) = delete; pinned_executor& operator=(pinned_executor&&) = delete; bool execute(const std::shared_ptr<mailbox> & mbox) override; }; } // namespace actors } // namespace yato #endif //_YATO_ACTORS_PINNED_EXECUTOR_H_
21.459016
118
0.690604
[ "vector" ]
1d18dbd5c41f1179a7493b84a1d3e1eb6331d8e0
2,774
h
C
Gems/AudioSystem/Code/Tests/Mocks/ATLEntitiesMock.h
cypherdotXd/o3de
bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676
[ "Apache-2.0", "MIT" ]
11
2021-07-08T09:58:26.000Z
2022-03-17T17:59:26.000Z
Gems/AudioSystem/Code/Tests/Mocks/ATLEntitiesMock.h
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
29
2021-07-06T19:33:52.000Z
2022-03-22T10:27:49.000Z
Gems/AudioSystem/Code/Tests/Mocks/ATLEntitiesMock.h
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
4
2021-07-06T19:24:43.000Z
2022-03-31T12:42:27.000Z
/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #include <ATLEntities.h> #include <AzTest/AzTest.h> namespace Audio { class ATLDebugNameStoreMock #if !defined(AUDIO_RELEASE) : public CATLDebugNameStore #endif { public: #if !defined(AUDIO_RELEASE) MOCK_METHOD1(SyncChanges, void(const CATLDebugNameStore&)); #endif MOCK_METHOD2(AddAudioObject, void(const TAudioObjectID, const char* const)); MOCK_METHOD2(AddAudioTrigger, void(const TAudioControlID, const char* const)); MOCK_METHOD2(AddAudioRtpc, void(const TAudioControlID, const char* const)); MOCK_METHOD2(AddAudioSwitch, void(const TAudioControlID, const char* const)); MOCK_METHOD3(AddAudioSwitchState, void(const TAudioControlID, const TAudioSwitchStateID, const char* const)); MOCK_METHOD2(AddAudioPreloadRequest, void(const TAudioPreloadRequestID, const char* const)); MOCK_METHOD2(AddAudioEnvironment, void(const TAudioEnvironmentID, const char* const)); MOCK_METHOD1(RemoveAudioObject, void(const TAudioObjectID)); MOCK_METHOD1(RemoveAudioTrigger, void(const TAudioControlID)); MOCK_METHOD1(RemoveAudioRtpc, void(const TAudioControlID)); MOCK_METHOD1(RemoveAudioSwitch, void(const TAudioControlID)); MOCK_METHOD2(RemoveAudioSwitchState, void(const TAudioControlID, const TAudioSwitchStateID)); MOCK_METHOD1(RemoveAudioPreloadRequest, void(const TAudioPreloadRequestID)); MOCK_METHOD1(RemoveAudioEnvironment, void(const TAudioEnvironmentID)); MOCK_CONST_METHOD0(AudioObjectsChanged, bool()); MOCK_CONST_METHOD0(AudioTriggersChanged, bool()); MOCK_CONST_METHOD0(AudioRtpcsChanged, bool()); MOCK_CONST_METHOD0(AudioSwitchesChanged, bool()); MOCK_CONST_METHOD0(AudioPreloadsChanged, bool()); MOCK_CONST_METHOD0(AudioEnvironmentsChanged, bool()); MOCK_CONST_METHOD1(LookupAudioObjectName, const char*(const TAudioObjectID)); MOCK_CONST_METHOD1(LookupAudioTriggerName, const char*(const TAudioControlID)); MOCK_CONST_METHOD1(LookupAudioRtpcName, const char*(const TAudioControlID)); MOCK_CONST_METHOD1(LookupAudioSwitchName, const char*(const TAudioControlID)); MOCK_CONST_METHOD2(LookupAudioSwitchStateName, const char*(const TAudioControlID, const TAudioSwitchStateID)); MOCK_CONST_METHOD1(LookupAudioPreloadRequestName, const char*(const TAudioPreloadRequestID)); MOCK_CONST_METHOD1(LookupAudioEnvironmentName, const char*(const TAudioEnvironmentID)); }; } // namespace Audio
47.827586
118
0.756309
[ "3d" ]
1d3eda0832fe0126327120820a775b3fb9edf56f
853
h
C
DataCenter/DataCenter/BSTally/Detail/BorrowDetail+CoreDataProperties.h
imagons/BSTally
5fef27cfc74be1634da602c54ffa523f39180515
[ "MIT" ]
null
null
null
DataCenter/DataCenter/BSTally/Detail/BorrowDetail+CoreDataProperties.h
imagons/BSTally
5fef27cfc74be1634da602c54ffa523f39180515
[ "MIT" ]
null
null
null
DataCenter/DataCenter/BSTally/Detail/BorrowDetail+CoreDataProperties.h
imagons/BSTally
5fef27cfc74be1634da602c54ffa523f39180515
[ "MIT" ]
null
null
null
// // BorrowDetail+CoreDataProperties.h // DataCenter // // Created by Danyow on 16/8/14. // Copyright © 2016年 Danyow.Ed. All rights reserved. // // Choose "Create NSManagedObject Subclass…" from the Core Data editor menu // to delete and recreate this implementation file for your updated model. // #import "BorrowDetail.h" NS_ASSUME_NONNULL_BEGIN @interface BorrowDetail (CoreDataProperties) @property (nullable, nonatomic, retain) NSMutableSet<PayBorrowDetail *> *payBorrowDetails; @end @interface BorrowDetail (CoreDataGeneratedAccessors) - (void)addPayBorrowDetailsObject:(PayBorrowDetail *)value; - (void)removePayBorrowDetailsObject:(PayBorrowDetail *)value; - (void)addPayBorrowDetails:(NSMutableSet<PayBorrowDetail *> *)values; - (void)removePayBorrowDetails:(NSMutableSet<PayBorrowDetail *> *)values; @end NS_ASSUME_NONNULL_END
26.65625
90
0.781946
[ "model" ]
1d45d3d97c9b057bea960e4e007391ec9423adb5
19,658
h
C
external/activemq-cpp-library-3.4.1/src/main/decaf/internal/nio/BufferFactory.h
framos-gemini/giapi-glue-cc
f59e1ce572494b57aad6985f3233f0e51167bb42
[ "BSD-3-Clause" ]
null
null
null
external/activemq-cpp-library-3.4.1/src/main/decaf/internal/nio/BufferFactory.h
framos-gemini/giapi-glue-cc
f59e1ce572494b57aad6985f3233f0e51167bb42
[ "BSD-3-Clause" ]
3
2017-06-14T15:21:50.000Z
2020-08-03T19:51:57.000Z
external/activemq-cpp-library-3.4.1/src/main/decaf/internal/nio/BufferFactory.h
framos-gemini/giapi-glue-cc
f59e1ce572494b57aad6985f3233f0e51167bb42
[ "BSD-3-Clause" ]
3
2017-06-13T13:59:36.000Z
2021-02-09T02:01:14.000Z
/* * 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 _DECAF_INTERNAL_NIO_BUFFERFACTORY_H_ #define _DECAF_INTERNAL_NIO_BUFFERFACTORY_H_ #include <decaf/nio/ByteBuffer.h> #include <decaf/nio/CharBuffer.h> #include <decaf/nio/DoubleBuffer.h> #include <decaf/nio/FloatBuffer.h> #include <decaf/nio/LongBuffer.h> #include <decaf/nio/IntBuffer.h> #include <decaf/nio/ShortBuffer.h> #include <decaf/lang/exceptions/IndexOutOfBoundsException.h> namespace decaf{ namespace internal{ namespace nio{ /** * Factory class used by static methods in the decaf::nio package to * create the various default version of the NIO interfaces. * * @since 1.0 */ class DECAF_API BufferFactory { public: virtual ~BufferFactory() {} /** * Allocates a new byte buffer whose position will be zero its limit will * be its capacity and its mark is not set. * * @param capacity * The internal buffer's capacity. * * @returns a newly allocated ByteBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::ByteBuffer* createByteBuffer( int capacity ); /** * Wraps the passed buffer with a new ByteBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new ByteBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::ByteBuffer* createByteBuffer( unsigned char* buffer, int size, int offset, int length ); /** * Wraps the passed STL Byte Vector in a ByteBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new ByteBuffer that is backed by buffer, caller owns. */ static decaf::nio::ByteBuffer* createByteBuffer( std::vector<unsigned char>& buffer ); /** * Allocates a new char buffer whose position will be zero its limit will * be its capacity and its mark is not set. * * @param capacity * The internal buffer's capacity. * * @returns a newly allocated CharBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::CharBuffer* createCharBuffer( int capacity ); /** * Wraps the passed buffer with a new CharBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new CharBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::CharBuffer* createCharBuffer( char* buffer, int size, int offset, int length ); /** * Wraps the passed STL Byte Vector in a CharBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new CharBuffer that is backed by buffer, caller owns. */ static decaf::nio::CharBuffer* createCharBuffer( std::vector<char>& buffer ); /** * Allocates a new double buffer whose position will be zero its limit will * be its capacity and its mark is not set. * * @param capacity * The internal buffer's capacity. * * @returns a newly allocated DoubleBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::DoubleBuffer* createDoubleBuffer( int capacity ); /** * Wraps the passed buffer with a new DoubleBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new DoubleBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::DoubleBuffer* createDoubleBuffer( double* buffer, int size, int offset, int length ); /** * Wraps the passed STL Double Vector in a DoubleBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new DoubleBuffer that is backed by buffer, caller owns. */ static decaf::nio::DoubleBuffer* createDoubleBuffer( std::vector<double>& buffer ); /** * Allocates a new float buffer whose position will be zero its limit will * be its capacity and its mark is not set. * * @param capacity * The internal buffer's capacity. * * @returns a newly allocated FloatBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::FloatBuffer* createFloatBuffer( int capacity ); /** * Wraps the passed buffer with a new FloatBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new FloatBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::FloatBuffer* createFloatBuffer( float* buffer, int size, int offset, int length ); /** * Wraps the passed STL Float Vector in a FloatBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new FloatBuffer that is backed by buffer, caller owns. */ static decaf::nio::FloatBuffer* createFloatBuffer( std::vector<float>& buffer ); /** * Allocates a new long long buffer whose position will be zero its limit will * be its capacity and its mark is not set. * @param capacity - the internal buffer's capacity. * @returns a newly allocated DoubleBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::LongBuffer* createLongBuffer( int capacity ); /** * Wraps the passed buffer with a new LongBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new LongBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::LongBuffer* createLongBuffer( long long* buffer, int size, int offset, int length ); /** * Wraps the passed STL Long Vector in a LongBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new LongBuffer that is backed by buffer, caller owns. */ static decaf::nio::LongBuffer* createLongBuffer( std::vector<long long>& buffer ); /** * Allocates a new int buffer whose position will be zero its limit will * be its capacity and its mark is not set. * * @param capacity * The internal buffer's capacity. * * @returns a newly allocated IntBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::IntBuffer* createIntBuffer( int capacity ); /** * Wraps the passed buffer with a new IntBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new IntBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::IntBuffer* createIntBuffer( int* buffer, int size, int offset, int length ); /** * Wraps the passed STL int Vector in a IntBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new IntBuffer that is backed by buffer, caller owns. */ static decaf::nio::IntBuffer* createIntBuffer( std::vector<int>& buffer ); /** * Allocates a new short buffer whose position will be zero its limit will * be its capacity and its mark is not set. * * @param capacity * The internal buffer's capacity. * * @returns a newly allocated ShortBuffer which the caller owns. * * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::ShortBuffer* createShortBuffer( int capacity ); /** * Wraps the passed buffer with a new ShortBuffer. * * The new buffer will be backed by the given byte array; that is, modifications * to the buffer will cause the array to be modified and vice versa. The new * buffer's capacity will be array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its backing array * will be the given array, and its array offset will be zero. * * @param buffer * The array that will back the new buffer. * @param size * The size of the specified buffer. * @param offset * The offset of the subarray to be used. * @param length * The length of the subarray to be used. * * @returns a new ShortBuffer that is backed by buffer, caller owns the returned pointer. * * @throws NullPointerException if the buffer given in Null. * @throws IndexOutOfBoundsException if the capacity specified is negative. */ static decaf::nio::ShortBuffer* createShortBuffer( short* buffer, int size, int offset, int length ); /** * Wraps the passed STL Short Vector in a ShortBuffer. * * The new buffer will be backed by the given byte array; modifications to the * buffer will cause the array to be modified and vice versa. The new buffer's * capacity and limit will be buffer.size(), its position will be zero, and its * mark will be undefined. Its backing array will be the given array, and its * array offset will be zero. * * @param buffer * The vector that will back the new buffer, the vector must have been * sized to the desired size already by calling vector.resize( N ). * * @returns a new DoubleBuffer that is backed by buffer, caller owns. */ static decaf::nio::ShortBuffer* createShortBuffer( std::vector<short>& buffer ); }; }}} #endif /*_DECAF_INTERNAL_NIO_BUFFERFACTORY_H_*/
45.294931
112
0.618323
[ "vector" ]
1d4cdc586a2e808a9e54cc93794e5e5361d12441
755
c
C
d1.c
la-vie-l-amour/aaa
77559ba31fb0c19f488268b8b9f7c0fbc5d67283
[ "MIT" ]
null
null
null
d1.c
la-vie-l-amour/aaa
77559ba31fb0c19f488268b8b9f7c0fbc5d67283
[ "MIT" ]
null
null
null
d1.c
la-vie-l-amour/aaa
77559ba31fb0c19f488268b8b9f7c0fbc5d67283
[ "MIT" ]
null
null
null
#include<stdio.h> #include<string.h> int main() { char s[20]; int s1,s2,s3,s4,s5,s0; printf("please enter a string\n"); gets(s); s0=strlen(s); s1=kg(s); s2=sz(s); s3=dxzm(s); s4=xxzm(s); s5=s0-s1-s2-s3-s4; printf("kongge=%-3d shuzi=%-3d dxzm=%-3d xxzm=%-3d qtzf=%-3d",s1,s2,s3,s4,s5); } int kg(char *p) { int i,s=0; for(i=0;p[i]!='\0';i++) if(p[i]==' ') s++; return s; } int sz(char *p) { int s=0,i; for(i=0;p[i]!='\0';i++) if(p[i]>='0'&&p[i]<='9') s++; return s; } int dxzm(char *p) { int s=0,i; for(i=0;p[i]!='\0';i++) if(p[i]>='A'&&p[i]<='Z') s++; return s; } int xxzm(char *p) { int s=0,i; for(i=0;p[i]!='\0';i++) if(p[i]>='a'&&p[i]<='z') s++; return s; }
15.1
80
0.455629
[ "3d" ]
1d4f2c845399e2000ee1a4ab52aa998a5646d2c8
21,836
h
C
src/BlueprintParser.h
zendesk/snowcrash
e1723184173e251518a1fd5f447bcc0e0ee47462
[ "MIT" ]
1
2020-09-27T14:27:51.000Z
2020-09-27T14:27:51.000Z
src/BlueprintParser.h
zendesk/snowcrash
e1723184173e251518a1fd5f447bcc0e0ee47462
[ "MIT" ]
null
null
null
src/BlueprintParser.h
zendesk/snowcrash
e1723184173e251518a1fd5f447bcc0e0ee47462
[ "MIT" ]
null
null
null
// // BlueprintParser.h // snowcrash // // Created by Zdenek Nemec on 4/16/13. // Copyright (c) 2013 Apiary Inc. All rights reserved. // #ifndef SNOWCRASH_BLUEPRINTPARSER_H #define SNOWCRASH_BLUEPRINTPARSER_H #include "ResourceParser.h" #include "ResourceGroupParser.h" #include "DataStructuresParser.h" #include "DataStructureParser.h" #include "SectionParser.h" #include "RegexMatch.h" #include "CodeBlockUtility.h" namespace snowcrash { const char* const ExpectedAPINameMessage = "expected API name, e.g. '# <API Name>'"; /** Internal type alias for Collection iterator of Metadata */ typedef Collection<Metadata>::iterator MetadataCollectionIterator; /** * Blueprint processor */ template<> struct SectionProcessor<Blueprint> : public SectionProcessorBase<Blueprint> { static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node, const MarkdownNodes& siblings, SectionParserData& pd, SectionLayout& layout, const ParseResultRef<Blueprint>& out) { MarkdownNodeIterator cur = node; while (cur != siblings.end() && cur->type == mdp::ParagraphMarkdownNodeType) { IntermediateParseResult<MetadataCollection> metadata(out.report); parseMetadata(cur, pd, metadata); // First block is paragraph and is not metadata (no API name) if (metadata.node.empty()) { return processDescription(cur, siblings, pd, out); } else { out.node.metadata.insert(out.node.metadata.end(), metadata.node.begin(), metadata.node.end()); if (pd.exportSourceMap()) { out.sourceMap.metadata.collection.insert(out.sourceMap.metadata.collection.end(), metadata.sourceMap.collection.begin(), metadata.sourceMap.collection.end()); } } cur++; } // Ideally this parsing metadata should be handled by separate parser // that way the following check would be covered in SectionParser::parse() if (cur == siblings.end()) return cur; if (cur->type == mdp::HeaderMarkdownNodeType) { SectionType nestedType = nestedSectionType(cur); // Resources Groups and Data Structures only, parse as exclusive nested sections if (nestedType != UndefinedSectionType) { layout = ExclusiveNestedSectionLayout; return cur; } // Name of the API out.node.name = cur->text; TrimString(out.node.name); if (pd.exportSourceMap() && !out.node.name.empty()) { out.sourceMap.name.sourceMap = cur->sourceMap; } } else { // Any other type of block, add to description return processDescription(cur, siblings, pd, out); } return ++MarkdownNodeIterator(cur); } static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node, const MarkdownNodes& siblings, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { if (pd.sectionContext() == ResourceGroupSectionType || pd.sectionContext() == ResourceSectionType) { IntermediateParseResult<ResourceGroup> resourceGroup(out.report); MarkdownNodeIterator cur = ResourceGroupParser::parse(node, siblings, pd, resourceGroup); ResourceGroupIterator duplicate = findResourceGroup(out.node.resourceGroups, resourceGroup.node); if (duplicate != out.node.resourceGroups.end()) { // WARN: duplicate resource group std::stringstream ss; if (resourceGroup.node.name.empty()) { ss << "anonymous group"; } else { ss << "group '" << resourceGroup.node.name << "'"; } ss << " is already defined"; mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData); out.report.warnings.push_back(Warning(ss.str(), DuplicateWarning, sourceMap)); } out.node.resourceGroups.push_back(resourceGroup.node); if (pd.exportSourceMap()) { out.sourceMap.resourceGroups.collection.push_back(resourceGroup.sourceMap); } return cur; } else if (pd.sectionContext() == DataStructuresSectionType) { IntermediateParseResult<DataStructures> ds(out.report); MarkdownNodeIterator cur = DataStructuresParser::parse(node, siblings, pd, ds); out.node.dataStructures = ds.node; if (pd.exportSourceMap()) { out.sourceMap.dataStructures = ds.sourceMap; } return cur; } return node; } static SectionType sectionType(const MarkdownNodeIterator& node) { return BlueprintSectionType; } static SectionType nestedSectionType(const MarkdownNodeIterator& node) { SectionType nestedType = UndefinedSectionType; // Check if Resource section nestedType = SectionProcessor<Resource>::sectionType(node); if (nestedType != UndefinedSectionType) { return nestedType; } // Check if ResourceGroup section nestedType = SectionProcessor<ResourceGroup>::sectionType(node); if (nestedType != UndefinedSectionType) { return nestedType; } // Check if DataStructures section nestedType = SectionProcessor<DataStructures>::sectionType(node); if (nestedType != UndefinedSectionType) { return nestedType; } return UndefinedSectionType; } static SectionTypes nestedSectionTypes() { SectionTypes nested; // Resource Group & descendants nested.push_back(ResourceGroupSectionType); insertNestedSectionTypes<ResourceGroup>(nested); // Data Structures & descendants nested.push_back(DataStructuresSectionType); insertNestedSectionTypes<DataStructures>(nested); return nested; } template<typename T> static void insertNestedSectionTypes(SectionTypes& nested) { SectionTypes types = SectionProcessor<T>::nestedSectionTypes(); nested.insert(nested.end(), types.begin(), types.end()); } static void finalize(const MarkdownNodeIterator& node, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { checkLazyReferencing(pd, out); if (!out.node.name.empty()) return; if (pd.options & RequireBlueprintNameOption) { // ERR: No API name specified mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData); out.report.error = Error(ExpectedAPINameMessage, BusinessError, sourceMap); } else if (!out.node.description.empty()) { mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData); out.report.warnings.push_back(Warning(ExpectedAPINameMessage, APINameWarning, sourceMap)); } } static bool isUnexpectedNode(const MarkdownNodeIterator& node, SectionType sectionType) { // Since Blueprint is currently top-level node any unprocessed node should be reported return true; } static void parseMetadata(const MarkdownNodeIterator& node, SectionParserData& pd, const ParseResultRef<MetadataCollection>& out) { mdp::ByteBuffer content = node->text; TrimStringEnd(content); std::vector<mdp::ByteBuffer> lines = Split(content, '\n'); for (std::vector<mdp::ByteBuffer>::iterator it = lines.begin(); it != lines.end(); ++it) { Metadata metadata; if (CodeBlockUtility::keyValueFromLine(*it, metadata)) { out.node.push_back(metadata); if (pd.exportSourceMap()) { SourceMap<Metadata> metadataSM; metadataSM.sourceMap = node->sourceMap; out.sourceMap.collection.push_back(metadataSM); } } } if (lines.size() == out.node.size()) { // Check duplicates std::vector<mdp::ByteBuffer> duplicateKeys; for (MetadataCollectionIterator it = out.node.begin(); it != out.node.end(); ++it) { MetadataCollectionIterator from = it; if (++from == out.node.end()) break; MetadataCollectionIterator duplicate = std::find_if(from, out.node.end(), std::bind2nd(MatchFirsts<Metadata>(), *it)); if (duplicate != out.node.end() && std::find(duplicateKeys.begin(), duplicateKeys.end(), it->first) == duplicateKeys.end()) { duplicateKeys.push_back(it->first); // WARN: duplicate metadata definition std::stringstream ss; ss << "duplicate definition of '" << it->first << "'"; mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData); out.report.warnings.push_back(Warning(ss.str(), DuplicateWarning, sourceMap)); } } } else if (!out.node.empty()) { // WARN: malformed metadata block mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData); out.report.warnings.push_back(Warning("ignoring possible metadata, expected '<key> : <value>', one one per line", FormattingWarning, sourceMap)); } } /** Finds a resource group inside an resource groups collection */ static ResourceGroupIterator findResourceGroup(const ResourceGroups& resourceGroups, const ResourceGroup& resourceGroup) { return std::find_if(resourceGroups.begin(), resourceGroups.end(), std::bind2nd(MatchName<ResourceGroup>(), resourceGroup)); } /** * \brief Checks both blueprint and source map AST to resolve references with `Pending` state (Lazy referencing) * \param pd Section parser state * \param out Processed output */ static void checkLazyReferencing(SectionParserData& pd, const ParseResultRef<Blueprint>& out) { Collection<SourceMap<ResourceGroup> >::iterator resourceGroupSourceMapIt; if (pd.exportSourceMap()) { resourceGroupSourceMapIt = out.sourceMap.resourceGroups.collection.begin(); } for (ResourceGroups::iterator resourceGroupIt = out.node.resourceGroups.begin(); resourceGroupIt != out.node.resourceGroups.end(); ++resourceGroupIt) { checkResourceLazyReferencing(*resourceGroupIt, resourceGroupSourceMapIt, pd, out); if (pd.exportSourceMap()) { resourceGroupSourceMapIt++; } } } /** Traverses Resource Collection to resolve references with `Pending` state (Lazy referencing) */ static void checkResourceLazyReferencing(ResourceGroup& resourceGroup, Collection<SourceMap<ResourceGroup> >::iterator resourceGroupSourceMapIt, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { Collection<SourceMap<Resource> >::iterator resourceSourceMapIt; if (pd.exportSourceMap()) { resourceSourceMapIt = resourceGroupSourceMapIt->resources.collection.begin(); } for (Resources::iterator resourceIt = resourceGroup.resources.begin(); resourceIt != resourceGroup.resources.end(); ++resourceIt) { checkActionLazyReferencing(*resourceIt, resourceSourceMapIt, pd, out); if (pd.exportSourceMap()) { resourceSourceMapIt++; } } } /** Traverses Action Collection to resolve references with `Pending` state (Lazy referencing) */ static void checkActionLazyReferencing(Resource& resource, Collection<SourceMap<Resource> >::iterator resourceSourceMapIt, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { Collection<SourceMap<Action> >::iterator actionSourceMapIt; if (pd.exportSourceMap()) { actionSourceMapIt = resourceSourceMapIt->actions.collection.begin(); } for (Actions::iterator actionIt = resource.actions.begin(); actionIt != resource.actions.end(); ++actionIt) { checkExampleLazyReferencing(*actionIt, actionSourceMapIt, pd, out); if (pd.exportSourceMap()) { actionSourceMapIt++; } } } /** Traverses Transaction Example Collection AST to resolve references with `Pending` state (Lazy referencing) */ static void checkExampleLazyReferencing(Action& action, Collection<SourceMap<Action> >::iterator actionSourceMapIt, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { Collection<SourceMap<TransactionExample> >::iterator exampleSourceMapIt; if (pd.exportSourceMap()) { exampleSourceMapIt = actionSourceMapIt->examples.collection.begin(); } for (TransactionExamples::iterator transactionExampleIt = action.examples.begin(); transactionExampleIt != action.examples.end(); ++transactionExampleIt) { checkRequestLazyReferencing(*transactionExampleIt, exampleSourceMapIt, pd, out); checkResponseLazyReferencing(*transactionExampleIt, exampleSourceMapIt, pd, out); if (pd.exportSourceMap()) { exampleSourceMapIt++; } } } /** Traverses Request Collection to resolve references with `Pending` state (Lazy referencing) */ static void checkRequestLazyReferencing(TransactionExample& transactionExample, Collection<SourceMap<TransactionExample> >::iterator transactionExampleSourceMapIt, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { Collection<SourceMap<Request> >::iterator requestSourceMapIt; if (pd.exportSourceMap()) { requestSourceMapIt = transactionExampleSourceMapIt->requests.collection.begin(); } for (Requests::iterator requestIt = transactionExample.requests.begin(); requestIt != transactionExample.requests.end(); ++requestIt) { if (!requestIt->reference.id.empty() && requestIt->reference.meta.state == Reference::StatePending) { if (pd.exportSourceMap()) { ParseResultRef<Payload> payload(out.report, *requestIt, *requestSourceMapIt); resolvePendingSymbols(pd, payload); SectionProcessor<Payload>::checkRequest(requestIt->reference.meta.node, pd, payload); } else { SourceMap<Payload> tempSourceMap; ParseResultRef<Payload> payload(out.report, *requestIt, tempSourceMap); resolvePendingSymbols(pd, payload); SectionProcessor<Payload>::checkRequest(requestIt->reference.meta.node, pd, payload); } } if (pd.exportSourceMap()) { requestSourceMapIt++; } } } /** Traverses Response Collection to resolve references with `Pending` state (Lazy referencing) */ static void checkResponseLazyReferencing(TransactionExample& transactionExample, Collection<SourceMap<TransactionExample> >::iterator transactionExampleSourceMapIt, SectionParserData& pd, const ParseResultRef<Blueprint>& out) { Collection<SourceMap<Response> >::iterator responseSourceMapIt; if (pd.exportSourceMap()) { responseSourceMapIt = transactionExampleSourceMapIt->responses.collection.begin(); } for (Responses::iterator responseIt = transactionExample.responses.begin(); responseIt != transactionExample.responses.end(); ++responseIt) { if (!responseIt->reference.id.empty() && responseIt->reference.meta.state == Reference::StatePending) { if (pd.exportSourceMap()) { ParseResultRef<Payload> payload(out.report, *responseIt, *responseSourceMapIt); resolvePendingSymbols(pd, payload); SectionProcessor<Payload>::checkResponse(responseIt->reference.meta.node, pd, payload); } else { SourceMap<Payload> tempSourceMap; ParseResultRef<Payload> payload(out.report, *responseIt, tempSourceMap); resolvePendingSymbols(pd, payload); SectionProcessor<Payload>::checkResponse(responseIt->reference.meta.node, pd, payload); } } if (pd.exportSourceMap()) { responseSourceMapIt++; } } } /** * \brief Resolve pending references * \param pd Section parser state * \param out Processed output */ static void resolvePendingSymbols(SectionParserData& pd, const ParseResultRef<Payload>& out) { if (pd.symbolTable.resourceModels.find(out.node.reference.id) == pd.symbolTable.resourceModels.end()) { // ERR: Undefined symbol std::stringstream ss; ss << "Undefined symbol " << out.node.reference.id; mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(out.node.reference.meta.node->sourceMap, pd.sourceData); out.report.error = Error(ss.str(), SymbolError, sourceMap); out.node.reference.meta.state = Reference::StateUnresolved; } else { out.node.reference.meta.state = Reference::StateResolved; SectionProcessor<Payload>::assingReferredPayload(pd, out); } } }; /** Blueprint Parser */ typedef SectionParser<Blueprint, BlueprintSectionAdapter> BlueprintParser; } #endif
41.434535
147
0.526516
[ "vector" ]
1d506dd4925df9970a7990eb7148e261bef4e47c
16,118
c
C
Plugins/MaxQ/Source/ThirdParty/CSpice_Library/cspice/src/cspice/spkr05.c
gamergenic/Spaceflight-Toolkit-For-Unreal-Engine-5
11d81127dd296595bca30cb1565ff3b813210230
[ "MIT" ]
6
2022-01-21T19:58:08.000Z
2022-03-28T12:32:24.000Z
Plugins/MaxQ/Source/ThirdParty/CSpice_Library/cspice/src/cspice/spkr05.c
gamergenic/Spaceflight-Toolkit-For-Unreal-Engine-5
11d81127dd296595bca30cb1565ff3b813210230
[ "MIT" ]
null
null
null
Plugins/MaxQ/Source/ThirdParty/CSpice_Library/cspice/src/cspice/spkr05.c
gamergenic/Spaceflight-Toolkit-For-Unreal-Engine-5
11d81127dd296595bca30cb1565ff3b813210230
[ "MIT" ]
4
2022-02-12T10:01:40.000Z
2022-03-28T14:28:52.000Z
/* spkr05.f -- translated by f2c (version 19980913). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ #include "f2c.h" /* Table of constant values */ static integer c__2 = 2; static integer c__6 = 6; static integer c__12 = 12; /* $Procedure SPKR05 ( Read SPK record from segment, type 5 ) */ /* Subroutine */ int spkr05_(integer *handle, doublereal *descr, doublereal * et, doublereal *record) { /* System generated locals */ integer i__1, i__2; /* Builtin functions */ integer i_dnnt(doublereal *), s_rnge(char *, integer, char *, integer); /* Local variables */ doublereal data[100]; integer nrec, ndir, skip, type__, i__, n, begin; extern /* Subroutine */ int chkin_(char *, ftnlen), dafus_(doublereal *, integer *, integer *, doublereal *, integer *), moved_(doublereal *, integer *, doublereal *); integer group; extern /* Subroutine */ int dafgda_(integer *, integer *, integer *, doublereal *); doublereal dc[2]; integer ic[6], grpadd, remain, dirloc, addrss; extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen); extern integer lstltd_(doublereal *, integer *, doublereal *); extern logical return_(void); integer end; logical fnd; /* $ Abstract */ /* Read a single SPK data record from a segment of type 5 */ /* ( two body propagation between discrete state vectors ). */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* SPK */ /* $ Keywords */ /* EPHEMERIS */ /* $ Declarations */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- -------------------------------------------------- */ /* HANDLE I File handle. */ /* DESCR I Segment descriptor. */ /* ET I Target epoch. */ /* RECORD O Data record. */ /* $ Detailed_Input */ /* HANDLE, */ /* DESCR are the file handle and segment descriptor for */ /* the type 05 SPK segment to be read. */ /* ET is a target epoch, specified as ephemeris seconds past */ /* J2000, for which a data record from the segment is */ /* required. */ /* $ Detailed_Output */ /* RECORD is a logical record from the specified segment which, */ /* when evaluated at epoch ET, will give the state */ /* (position and velocity) of some body, relative */ /* to some center, in some inertial reference frame. */ /* The structure of RECORD is: */ /* RECORD(1) */ /* . state of the body at epoch 1. */ /* . */ /* . */ /* RECORD(6) */ /* RECORD(7) */ /* . */ /* . state of the body at epoch 2. */ /* . */ /* RECORD(12) */ /* RECORD(13) epoch 1 in seconds past 2000. */ /* RECORD(14) epoch 2 in seconds past 2000. */ /* RECORD(15) GM for the center of motion. */ /* Epoch 1 and epoch 2 are the times in the segment that */ /* bracket ET. If ET is less than the first time in the */ /* segment then both epochs 1 and 2 are equal to the */ /* first time. And if ET is greater than the last time */ /* then, epochs 1 and 2 are set equal to this last time. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If the segment specified by DESCR is not of data type 05, */ /* the error SPICE(WRONGSPKTYPE) is signaled. */ /* 2) No error is signaled if ET is outside the time bounds of */ /* the segment. The output RECORD will contain epochs and the */ /* associated states which satisfy the rules stated above. */ /* $ Files */ /* See argument HANDLE. */ /* $ Particulars */ /* This routine reads the segment specified by DESCR from the SPK */ /* file attached to HANDLE to locate the two epochs in the segment */ /* that bracket the input ET. It then returns a logical record which */ /* contains these times and their associated states, and also the */ /* mass of the center of motion. The routine makes explicit use of */ /* the structure of the type 05 data segment to locate this data. */ /* See the section of the SPK Required Reading on data type 05 for */ /* a description of the structure of a type 05 segment. */ /* $ Examples */ /* The data returned by the SPKRnn routine is in its rawest form, */ /* taken directly from the segment. As such, it will be meaningless */ /* to a user unless he/she understands the structure of the data type */ /* completely. Given that understanding, however, the SPKRnn */ /* routines might be used to "dump" and check segment data for a */ /* particular epoch. */ /* C */ /* C Get a segment applicable to a specified body and epoch. */ /* C */ /* CALL SPKSFS ( BODY, ET, HANDLE, DESCR, IDENT, FOUND ) */ /* IF ( FOUND ) THEN */ /* C */ /* C Look at parts of the descriptor. */ /* C */ /* CALL DAFUS ( DESCR, 2, 6, DCD, ICD ) */ /* CENTER = ICD( 2 ) */ /* REF = ICD( 3 ) */ /* TYPE = ICD( 4 ) */ /* IF ( TYPE .EQ. 05 ) THEN */ /* CALL SPKR05 ( HANDLE, DESCR, ET, RECORD ) */ /* . */ /* . Look at the RECORD data. */ /* . */ /* END IF */ /* END IF */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* J. Diaz del Rio (ODC Space) */ /* J.M. Lynch (JPL) */ /* W.L. Taber (JPL) */ /* I.M. Underwood (JPL) */ /* E.D. Wright (JPL) */ /* $ Version */ /* - SPICELIB Version 1.1.1, 12-AUG-2021 (JDR) */ /* Edited the header to comply with NAIF standard. */ /* - SPICELIB Version 1.1.0, 07-SEP-2001 (EDW) */ /* Replaced DAFRDA call with DAFGDA. */ /* Added IMPLICIT NONE. */ /* - SPICELIB Version 1.0.0, 01-APR-1992 (JML) (WLT) (IMU) */ /* -& */ /* $ Index_Entries */ /* read record from type_5 SPK segment */ /* -& */ /* Local parameters */ /* SPICELIB functions */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("SPKR05", (ftnlen)6); } /* Unpack the segment descriptor. */ dafus_(descr, &c__2, &c__6, dc, ic); type__ = ic[3]; begin = ic[4]; end = ic[5]; /* Make sure that this really is a type 5 data segment. */ if (type__ != 5) { setmsg_("You are attempting to locate type 5 data in a type # data s" "egment.", (ftnlen)66); errint_("#", &type__, (ftnlen)1); sigerr_("SPICE(WRONGSPKTYPE)", (ftnlen)19); chkout_("SPKR05", (ftnlen)6); return 0; } /* Get the number of records in the segment. While we're at it, */ /* get the GM of the central body (it's adjacent to NREC) */ /* since we'll need it anyway. Put it where it belongs, at the */ /* end of the output record. */ i__1 = end - 1; dafgda_(handle, &i__1, &end, data); nrec = i_dnnt(&data[1]); record[14] = data[0]; /* From the number of records, we can compute the number of */ /* directory epochs. */ ndir = nrec / 100; /* The directory epochs narrow down the search to a group of DIRSIZ */ /* or fewer records. Because the Ith directory epoch is the I*100th */ /* epoch, the Ith group will contain epochs ((I-1)*100 + 1) through */ /* (I*100). For example: */ /* group first epoch # last epoch # */ /* ----- ------------- ------------ */ /* 1 1 100 */ /* 2 101 200 */ /* . . . */ /* . . . */ /* 10 901 1000 */ /* . . . */ /* . . . */ /* N (N-1)*100+1 N*100 */ if (ndir == 0) { /* There is only one group if there are no directory epochs. */ group = 1; } else { /* Compute the location of the first directory epoch. From the */ /* beginning of the segment, we need to go through all of the */ /* NREC states and epochs. */ dirloc = begin + nrec * 7; /* Determine which group of DIRSIZ times to search, by finding */ /* the last directory epoch that is less than ET. */ fnd = FALSE_; remain = ndir; group = 0; while(! fnd) { /* Read in as many as BUFSIZ directory epochs at a time */ /* for comparison. */ n = min(remain,100); i__1 = dirloc + n - 1; dafgda_(handle, &dirloc, &i__1, data); remain -= n; /* Determine the last directory element in DATA that's less */ /* than ET. */ /* If we reach the end of the directories, and still haven't */ /* found one bigger than the epoch, the group is the last group */ /* in the segment. */ /* Otherwise keep looking. */ i__ = lstltd_(et, &n, data); if (i__ < n) { group = group + i__ + 1; fnd = TRUE_; } else if (remain == 0) { group = ndir + 1; fnd = TRUE_; } else { dirloc += n; group += n; } } } /* Now we know which group of DIRSIZ (or less) epochs to look at. */ /* Out of the NREC epochs, the number that we should skip over */ /* to get to the proper group is DIRSIZ * ( GROUP - 1 ). */ skip = (group - 1) * 100; /* From this we can compute the index into the segment of the group */ /* of times we want. From the beginning, we need to pass through */ /* STASIZ * NREC state numbers to get to the first epoch. Then we */ /* skip over the number just computed above. */ grpadd = begin + nrec * 6 + skip; /* The number of epochs that we have to look at may be less than */ /* DIRSIZ. However many there are, go ahead and read them into the */ /* buffer. */ /* If there are no times in the last group then the time that we */ /* are looking for is the same as the last directory epoch. */ /* We should not try to read in this instance. */ /* Computing MIN */ i__1 = 100, i__2 = nrec - skip; n = min(i__1,i__2); if (n != 0) { i__1 = grpadd + n - 1; dafgda_(handle, &grpadd, &i__1, data); /* Find the index of the largest time in the group that is less */ /* than the input time. */ i__ = lstltd_(et, &n, data); } else { /* If we are here it means that ET is greater then the last */ /* time in the segment and there are no elements in the last */ /* group. This can occur when the number of epochs is a multiple */ /* DIRSIZ. */ /* By setting N equal to I we can handle this case in the */ /* same branch as when there are elements in the last group. */ /* This is because the DATA array still contains the directory */ /* epochs and I is pointing at the last element which is also the */ /* last time in the segment. */ n = i__; } /* At this point N is the number of epochs in this GROUP which is */ /* also the size of the array DATA which contains the epochs. I is */ /* the index of the largest time in DATA which is less than ET. */ /* We need to take different actions depending on whether ET is less */ /* than the first time or greater than the last one in the GROUP. */ if (i__ == 0) { if (group == 1) { /* ET is less than or equal to the first time in the segment. */ /* Return the state at the first time twice. */ record[12] = data[0]; record[13] = data[0]; i__1 = begin + 5; dafgda_(handle, &begin, &i__1, data); moved_(data, &c__6, record); moved_(data, &c__6, &record[6]); chkout_("SPKR05", (ftnlen)6); return 0; } else { /* ET is less than or equal to the first time in this group */ /* but not the first time in the segment. Get the last time */ /* from the preceding group. The states for this case will */ /* be read outside of the IF block. */ i__1 = grpadd - 1; dafgda_(handle, &i__1, &grpadd, data); record[12] = data[0]; record[13] = data[1]; } } else if (i__ == n) { if (group == ndir + 1) { /* ET is greater than all of the times in the segment. Return */ /* the state for the last time twice. */ record[12] = data[(i__1 = n - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge("data", i__1, "spkr05_", (ftnlen)488)]; record[13] = data[(i__1 = n - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge("data", i__1, "spkr05_", (ftnlen)489)]; addrss = begin + (nrec - 1) * 6; i__1 = addrss + 5; dafgda_(handle, &addrss, &i__1, data); moved_(data, &c__6, record); moved_(data, &c__6, &record[6]); chkout_("SPKR05", (ftnlen)6); return 0; } else { /* ET is greater than the last time in this group but this is */ /* not the last time in the segment. Need the first time from */ /* the following group. The states for this case will be read */ /* outside of the IF block. */ i__1 = grpadd + n - 1; i__2 = grpadd + n; dafgda_(handle, &i__1, &i__2, data); record[12] = data[0]; record[13] = data[1]; } } else { /* There are two times in the group that bracket ET. The states */ /* for this case will be read outside of the IF block. */ record[12] = data[(i__1 = i__ - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge( "data", i__1, "spkr05_", (ftnlen)520)]; record[13] = data[(i__1 = i__) < 100 && 0 <= i__1 ? i__1 : s_rnge( "data", i__1, "spkr05_", (ftnlen)521)]; } /* Read the consecutive states for the two epochs found above. */ /* ET is greater than the (SKIP + I)th time but less than or */ /* equal to the time (SKIP + I + 1). */ addrss = begin + (skip + i__ - 1) * 6; i__1 = addrss + 11; dafgda_(handle, &addrss, &i__1, data); moved_(data, &c__12, record); chkout_("SPKR05", (ftnlen)6); return 0; } /* spkr05_ */
33.3706
77
0.548269
[ "object" ]
1d530759bcdbf076a41750f39a9235083cda0752
8,542
c
C
Tools/glue/vector.c
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Tools/glue/vector.c
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Tools/glue/vector.c
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
/*********************************************************************** * * Copyright (c) GeoWorks 1991 -- All Rights Reserved * * PROJECT: PCGEOS * MODULE: Glue -- Vector maintenance. * FILE: vector.c * * AUTHOR: Adam de Boor: Mar 18, 1991 * * ROUTINES: * Name Description * ---- ----------- * * REVISION HISTORY: * Date Name Description * ---- ---- ----------- * 3/18/91 ardeb Initial version * * DESCRIPTION: * Vector functions. Stolen from Swat...but without the memory * tracing stuff that's there. * ***********************************************************************/ #ifndef lint static char *rcsid = "$Id: vector.c,v 1.4 92/10/27 20:52:10 adam Exp $"; #endif lint #include "glue.h" #include "vector.h" #define DEFAULT_INITIAL_SIZE 10 /*- *----------------------------------------------------------------------- * Vector_Create -- * Create and initialize a vector with the appropriate values. * * Results: * The newly-created vector. * * Side Effects: * Memory is allocated. * *----------------------------------------------------------------------- */ Vector Vector_Create(int dataSize, /* Size of each element */ Vector_Adjust adjustType, /* Way to expand when overflows */ int adjustSize, /* Size of adjustment to make */ int initialSize) /* Initial size of vector */ { VectorPtr v; if (initialSize <= 0) { initialSize = DEFAULT_INITIAL_SIZE; } v = (VectorPtr)malloc(sizeof(VectorRec)); v->data = (Address)malloc(initialSize * dataSize); v->num = 0; v->max = initialSize; v->size = dataSize; v->adj = adjustType; v->adjSize = adjustSize; return ((Vector)v); } /*- *----------------------------------------------------------------------- * Vector_Empty -- * Empty out a vector. * * Results: * None. * * Side Effects: * The array of data is zero-filled and num set to 0. * *----------------------------------------------------------------------- */ void Vector_Empty(Vector vector) { register VectorPtr v = (VectorPtr)vector; bzero(v->data, v->num * v->size); v->num = 0; } /*- *----------------------------------------------------------------------- * Vector_Truncate -- * Truncate a vector to a particular size. * * Results: * None. * * Side Effects: * The array of data is zero-filled and num set to 0. * *----------------------------------------------------------------------- */ void Vector_Truncate(Vector vector, int size) { register VectorPtr v = (VectorPtr)vector; /* * Make sure the vector is at least that long. */ if (v->num < size) { Address element; element = (Address)calloc(1, v->size); Vector_Add(vector, size-1, element); free(element); } else if (v->num > size) { /* * Zero out the elements beyond what is now the end. */ bzero(v->data + (size * v->size), (v->num - size) * v->size); } /* * Truncate the vector at that size. */ v->num = size; } /*- *----------------------------------------------------------------------- * Vector_Destroy -- * Free all the memory used by a vector. * * Results: * None. * * Side Effects: * The data are freed and the vector should never be used again. * *----------------------------------------------------------------------- */ void Vector_Destroy(Vector vector) { register VectorPtr v = (VectorPtr)vector; free((char *)v->data); free((char *)v); } /*- *----------------------------------------------------------------------- * Vector_Data -- * Return a pointer to all the data in the vector. This pointer * should be used only for short references and is not guaranteed to * remain valid once the vector is changed in any way. * * Results: * A pointer to the data. * * Side Effects: * None. * *----------------------------------------------------------------------- */ Address Vector_Data(Vector vector) { return ((VectorPtr)vector)->data; } /*- *----------------------------------------------------------------------- * Vector_Size -- * Return the absolute size of the vector. This is the number of * bytes of data the vector can hold before it must be expanded. * * Results: * The size of the vector. * * Side Effects: * None. * *----------------------------------------------------------------------- */ int Vector_Size(Vector vector) { return ((VectorPtr)vector)->max * ((VectorPtr)vector)->size; } /*- *----------------------------------------------------------------------- * Vector_Length -- * Return the number of valid entries in the vector. * Note that there may be zero-filled holes in the vector if allocation * of entries is not sequential. * * Results: * The number of entries in the vector. * * Side Effects: * None. * *----------------------------------------------------------------------- */ int Vector_Length(Vector vector) { return ((VectorPtr)vector)->num; } /*- *----------------------------------------------------------------------- * Vector_Add -- * Add an element to a data vector at the given position. If the * position is below 0, the next available slot is used. * * Results: * None. * * Side Effects: * The element is copied into the vector. * *----------------------------------------------------------------------- */ void Vector_Add(Vector vector, /* Vector to change */ int offset, /* Place at which to store the data */ Address data) /* Pointer to data to store */ { register VectorPtr v = (VectorPtr)vector; if (offset < 0) { offset = v->num; } if (offset >= v->max) { int oldMax = v->max; if (v->adj == ADJUST_MULTIPLY) { do { v->max *= v->adjSize; } while (offset >= v->max); } else { do { v->max += v->adjSize; } while (offset >= v->max); } v->data = (Address)realloc(v->data, v->max * v->size); if (v->data == (Address)NULL) { printf("Out of memory in Vector_Add\n"); exit(1); } bzero(v->data + (oldMax * v->size), (v->max - oldMax) * v->size); } if (offset >= v->num) { bzero(v->data + (v->num * v->size), (offset + 1 - v->num) * v->size); v->num = offset + 1; } bcopy(data, v->data + offset * v->size, v->size); } /*- *----------------------------------------------------------------------- * Vector_Insert -- * Insert an element into a vector. The element takes the place * of the one at 'offset'. * * Results: * None. * * Side Effects: * All elements at offset and above are shifted up one. * *----------------------------------------------------------------------- */ void Vector_Insert(Vector vector, int offset, Address data) { register VectorPtr v = (VectorPtr)vector; if (offset >= v->num) { Vector_Add(vector, offset, data); } else { if (v->num == v->max) { /* * If we have to expand the vector to insert this element anyway, * simply allocate a new data array straight out and copy the data * over in two pieces, leaving room in the middle for the new element. */ Address newData; if (v->adj == ADJUST_MULTIPLY) { v->max *= v->adjSize; } else { v->max += v->adjSize; } newData = (Address)malloc(v->max * v->size); bcopy(v->data, newData, offset * v->size); bcopy(v->data + offset * v->size, (char *)newData + (offset + 1) * v->size, (v->num - offset) * v->size); free((char *)v->data); v->data = newData; } else { /* * No need to expand the vector, just shift all the elements up one * slot. */ bcopy(v->data + offset * v->size, v->data + (offset + 1) * v->size, (v->num - offset) * v->size); } /* * Copy the new element in */ bcopy(data, v->data + offset * v->size, v->size); v->num += 1; } } /*- *----------------------------------------------------------------------- * Vector_Get -- * Copy out an element of a data vector. * * Results: * TRUE if the element exists and FALSE otherwise. * * Side Effects: * If return TRUE, the element is copied into the passed buffer. * *----------------------------------------------------------------------- */ int Vector_Get(Vector vector, int offset, Address buf) { register VectorPtr v = (VectorPtr)vector; if ((offset >= v->num) || (offset < 0)) { return(0); } else { bcopy(v->data + offset * v->size, buf, v->size); return(1); } }
23.66205
75
0.478811
[ "vector" ]
1d59331acab31444c13e99c7a4ffb1c40cd67d12
527
h
C
0033.Search in Rotated Sorted Array/solution.h
onabc/leetcode
84e193960345fce9e181054054ac9c2f4a616995
[ "Apache-2.0" ]
null
null
null
0033.Search in Rotated Sorted Array/solution.h
onabc/leetcode
84e193960345fce9e181054054ac9c2f4a616995
[ "Apache-2.0" ]
null
null
null
0033.Search in Rotated Sorted Array/solution.h
onabc/leetcode
84e193960345fce9e181054054ac9c2f4a616995
[ "Apache-2.0" ]
null
null
null
using namespace std; class Solution { public: int search(vector<int>& nums, int target) { int l = 0, r = nums.size() - 1; while (l <= r) { int mid = (l + r) / 2; if (nums[mid] == target) return mid; if ((nums[l] <= target && target < nums[mid]) || (nums[mid] < nums[l] && (target < nums[mid] || target >= nums[l]))) r = mid - 1; else if ((nums[mid] < target && target <= nums[r]) || (nums[r] < nums[mid] && (target > nums[mid] || target <= nums[r]))) l = mid + 1; else break; } return -1; } };
29.277778
124
0.523719
[ "vector" ]
1d5e137ea962906ce65c98db35ff0c929b619cef
5,341
h
C
ROS workspaces/linorobot_ws/devel/include/lino_msgs/Velocities.h
arimendelow/automated_pipeline_inspector
0b3977eb86e66ae3ef056a48fd04dc5198864dc7
[ "MIT" ]
null
null
null
ROS workspaces/linorobot_ws/devel/include/lino_msgs/Velocities.h
arimendelow/automated_pipeline_inspector
0b3977eb86e66ae3ef056a48fd04dc5198864dc7
[ "MIT" ]
null
null
null
ROS workspaces/linorobot_ws/devel/include/lino_msgs/Velocities.h
arimendelow/automated_pipeline_inspector
0b3977eb86e66ae3ef056a48fd04dc5198864dc7
[ "MIT" ]
null
null
null
// Generated by gencpp from file lino_msgs/Velocities.msg // DO NOT EDIT! #ifndef LINO_MSGS_MESSAGE_VELOCITIES_H #define LINO_MSGS_MESSAGE_VELOCITIES_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> namespace lino_msgs { template <class ContainerAllocator> struct Velocities_ { typedef Velocities_<ContainerAllocator> Type; Velocities_() : linear_x(0.0) , linear_y(0.0) , angular_z(0.0) { } Velocities_(const ContainerAllocator& _alloc) : linear_x(0.0) , linear_y(0.0) , angular_z(0.0) { (void)_alloc; } typedef float _linear_x_type; _linear_x_type linear_x; typedef float _linear_y_type; _linear_y_type linear_y; typedef float _angular_z_type; _angular_z_type angular_z; typedef boost::shared_ptr< ::lino_msgs::Velocities_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::lino_msgs::Velocities_<ContainerAllocator> const> ConstPtr; }; // struct Velocities_ typedef ::lino_msgs::Velocities_<std::allocator<void> > Velocities; typedef boost::shared_ptr< ::lino_msgs::Velocities > VelocitiesPtr; typedef boost::shared_ptr< ::lino_msgs::Velocities const> VelocitiesConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::lino_msgs::Velocities_<ContainerAllocator> & v) { ros::message_operations::Printer< ::lino_msgs::Velocities_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace lino_msgs namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False} // {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'lino_msgs': ['/home/nvidia/linorobot_ws/src/lino_msgs/msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::lino_msgs::Velocities_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsFixedSize< ::lino_msgs::Velocities_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::lino_msgs::Velocities_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::lino_msgs::Velocities_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::lino_msgs::Velocities_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct HasHeader< ::lino_msgs::Velocities_<ContainerAllocator> const> : FalseType { }; template<class ContainerAllocator> struct MD5Sum< ::lino_msgs::Velocities_<ContainerAllocator> > { static const char* value() { return "0ee8ad4cb7809be2d5a0a76352fea86a"; } static const char* value(const ::lino_msgs::Velocities_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x0ee8ad4cb7809be2ULL; static const uint64_t static_value2 = 0xd5a0a76352fea86aULL; }; template<class ContainerAllocator> struct DataType< ::lino_msgs::Velocities_<ContainerAllocator> > { static const char* value() { return "lino_msgs/Velocities"; } static const char* value(const ::lino_msgs::Velocities_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::lino_msgs::Velocities_<ContainerAllocator> > { static const char* value() { return "\n\ float32 linear_x\n\ float32 linear_y\n\ float32 angular_z\n\ "; } static const char* value(const ::lino_msgs::Velocities_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::lino_msgs::Velocities_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.linear_x); stream.next(m.linear_y); stream.next(m.angular_z); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct Velocities_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::lino_msgs::Velocities_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::lino_msgs::Velocities_<ContainerAllocator>& v) { s << indent << "linear_x: "; Printer<float>::stream(s, indent + " ", v.linear_x); s << indent << "linear_y: "; Printer<float>::stream(s, indent + " ", v.linear_y); s << indent << "angular_z: "; Printer<float>::stream(s, indent + " ", v.angular_z); } }; } // namespace message_operations } // namespace ros #endif // LINO_MSGS_MESSAGE_VELOCITIES_H
25.927184
441
0.726268
[ "vector" ]
1d5eb248b8908ca6408d15d0e3aadde868337e0c
3,587
h
C
ecm/include/tencentcloud/ecm/v20190719/model/ModuleItem.h
TencentCloud/tencentcloud-sdk-cpp-intl-en
752c031f5ad2c96868183c5931eae3a42dd5ae6c
[ "Apache-2.0" ]
1
2022-01-27T09:27:34.000Z
2022-01-27T09:27:34.000Z
ecm/include/tencentcloud/ecm/v20190719/model/ModuleItem.h
TencentCloud/tencentcloud-sdk-cpp-intl-en
752c031f5ad2c96868183c5931eae3a42dd5ae6c
[ "Apache-2.0" ]
null
null
null
ecm/include/tencentcloud/ecm/v20190719/model/ModuleItem.h
TencentCloud/tencentcloud-sdk-cpp-intl-en
752c031f5ad2c96868183c5931eae3a42dd5ae6c
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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. */ #ifndef TENCENTCLOUD_ECM_V20190719_MODEL_MODULEITEM_H_ #define TENCENTCLOUD_ECM_V20190719_MODEL_MODULEITEM_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/ecm/v20190719/model/NodeInstanceNum.h> #include <tencentcloud/ecm/v20190719/model/Module.h> namespace TencentCloud { namespace Ecm { namespace V20190719 { namespace Model { /** * Item information of the module list */ class ModuleItem : public AbstractModel { public: ModuleItem(); ~ModuleItem() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取Instance statistics of the node * @return NodeInstanceNum Instance statistics of the node */ NodeInstanceNum GetNodeInstanceNum() const; /** * 设置Instance statistics of the node * @param NodeInstanceNum Instance statistics of the node */ void SetNodeInstanceNum(const NodeInstanceNum& _nodeInstanceNum); /** * 判断参数 NodeInstanceNum 是否已赋值 * @return NodeInstanceNum 是否已赋值 */ bool NodeInstanceNumHasBeenSet() const; /** * 获取Module information * @return Module Module information */ Module GetModule() const; /** * 设置Module information * @param Module Module information */ void SetModule(const Module& _module); /** * 判断参数 Module 是否已赋值 * @return Module 是否已赋值 */ bool ModuleHasBeenSet() const; private: /** * Instance statistics of the node */ NodeInstanceNum m_nodeInstanceNum; bool m_nodeInstanceNumHasBeenSet; /** * Module information */ Module m_module; bool m_moduleHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_ECM_V20190719_MODEL_MODULEITEM_H_
33.212963
116
0.536103
[ "vector", "model" ]
1d6b37f657f18e0bb084182f6658b65e75d3dda9
5,197
h
C
secude-4.1.all/secude/src/include/isode/quipu/oid.h
rekav0k/Applied-Cryptography
9eeb0dae04da62c858d018b5f5b2e0a96bdd162d
[ "BSD-4-Clause-UC" ]
4
2017-04-18T23:33:21.000Z
2021-04-17T04:59:54.000Z
secude/src/include/isode/quipu/oid.h
scorpiochn/Applied-Cryptography
9eeb0dae04da62c858d018b5f5b2e0a96bdd162d
[ "BSD-4-Clause-UC" ]
null
null
null
secude/src/include/isode/quipu/oid.h
scorpiochn/Applied-Cryptography
9eeb0dae04da62c858d018b5f5b2e0a96bdd162d
[ "BSD-4-Clause-UC" ]
3
2018-03-09T16:50:31.000Z
2019-04-21T07:52:15.000Z
/* oid.h - object identifier stuff */ /* * $Header: /xtel/isode/isode/h/quipu/RCS/oid.h,v 9.0 1992/06/16 12:23:11 isode Rel $ * * * $Log: oid.h,v $ * Revision 9.0 1992/06/16 12:23:11 isode * Release 8.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ #ifndef QUIPUOID #define QUIPUOID #include "psap.h" /* Definitions of OID's the DSA needs to know */ /* X500 defined attributes */ #define OBJECTCLASS_OID "2.5.4.0" #define ALIAS_OID "2.5.4.1" #define CN_OID "2.5.4.3" #define DSAADDRESS_OID "2.5.4.29" #define APPLCTX_OID "2.5.4.30" #define PASSWORD_OID "2.5.4.35" #define CERTIFICATE_OID "2.5.4.36" /* QUIPU defined attributes */ #define SCHEMA_OID "0.9.2342.19200300.99.1.1" #define ACL_OID "0.9.2342.19200300.99.1.2" #define EDBINFO_OID "0.9.2342.19200300.99.1.3" #define MASTERDSA_OID "0.9.2342.19200300.99.1.4" #define SLAVEDSA_OID "0.9.2342.19200300.99.1.5" #define CONTROL_OID "0.9.2342.19200300.99.1.15" #define VERSION_OID "0.9.2342.19200300.99.1.16" #define PROTECTED_OID "0.9.2342.19200300.99.1.17" #define INHERIT_OID "0.9.2342.19200300.99.1.21" #define RELAYDSA_OID "0.9.2342.19200300.99.1.23" #define SUBORD_OID "0.9.2342.19200300.99.1.25" #define XREF_OID "0.9.2342.19200300.99.1.26" #define NSSR_OID "0.9.2342.19200300.99.1.27" #define LISTEN_OID "0.9.2342.19200300.99.1.28" #define MASTER_E_OID "0.9.2342.19200300.99.1.30" #define SLAVE_E_OID "0.9.2342.19200300.99.1.31" #define CACHE_E_OID "0.9.2342.19200300.99.1.32" #define DSA_CONTROL_OID "0.9.2342.19200300.99.1.33" #define OPEN_CALL_OID "0.9.2342.19200300.99.1.34" #define U_RATE_OID "0.9.2342.19200300.99.1.35" /* COSINE/Internet defined attribute */ #define MANAGER_OID "0.9.2342.19200300.100.1.10" #define LAST_MOD_OID "0.9.2342.19200300.100.1.23" #define MOD_BY_OID "0.9.2342.19200300.100.1.24" #define SEARCHACL_OID "0.9.2342.19200300.100.1.57" #define LISTACL_OID "0.9.2342.19200300.100.1.58" #define AUTHPOLICY_OID "0.9.2342.19200300.100.1.59" /* Signature Algorithm */ #ifdef OSISEC #define SIGALG_OID SIGALGNAME() #else #define SIGALG_OID "0.9.2342.19200300.99.6.3.2" #endif /* alias objectclass */ #define ALIAS_OC "2.5.6.1" #define TOP_OC "2.5.6.0" /* NON leaf object class */ #define QUIPU_DSA "0.9.2342.19200300.99.3.1" #define NONLEAFOBJECT "0.9.2342.19200300.99.3.6" #define EXTERNOBJECT "0.9.2342.19200300.99.3.9" /* X500 defined protocol oids */ #if USE_BUILTIN_OIDS #define DIR_ACCESS_AC str2oid("2.5.3.1") #define DIR_SYSTEM_AC str2oid("2.5.3.2") #define DIR_QUIPU_AC str2oid("0.9.2342.19200300.99.4") #define DIR_INTERNET_AC str2oid("0.9.2342.19200300.100.8") #define DIR_ACCESS_AS str2oid("2.5.9.1") #define DIR_SYSTEM_AS str2oid("2.5.9.2") #define DIR_QUIPU_AS str2oid("0.9.2342.19200300.99.5") #define DIR_INTERNET_AS str2oid("0.9.2342.19200300.100.9") #define DIR_ACSE str2oid("2.2.1.0.1") #else /* use isobjects */ #define DIR_ACCESS_AC ode2oid("directory directoryAccessAC") #define DIR_SYSTEM_AC ode2oid("directory directorySystemAC") #define DIR_QUIPU_AC str2oid("0.9.2342.19200300.99.4") #define DIR_INTERNET_AC str2oid("0.9.2342.19200300.100.8") #define DIR_ACCESS_AS ode2oid("directory directoryAccessAS") #define DIR_SYSTEM_AS ode2oid("directory directorySystemAS") #define DIR_QUIPU_AS str2oid("0.9.2342.19200300.99.5") #define DIR_INTERNET_AS str2oid("0.9.2342.19200300.100.9") #define DIR_ACSE ode2oid("acse pci version 1") #endif /* Wrong file for the following, but they are connected to the above so... */ #define DIR_ACCESS_PC_ID 1 #define DIR_SYSTEM_PC_ID 1 #define DIR_QUIPU_PC_ID 1 #define DIR_INTERNET_PC_ID 1 #define DIR_ACSE_PC_ID 3 /* oid table lookup definitions */ #define SEPERATOR ':' #define DOT '.' #define COMMA ',' #define COMMENT '#' #define BUFSIZE 40 #define TABLESIZE 300 #define OIDPART 1 #define OIDFULL 2 #define OIDNUM 3 typedef struct { char *ot_name; char *ot_stroid; OID ot_oid; OID ot_aliasoid; } oid_table; #define NULLTABLE ((oid_table * )0) typedef struct { oid_table oa_ot; short oa_syntax; } oid_table_attr; #define NULLTABLE_ATTR ((oid_table_attr *)0) typedef struct seq_tab { oid_table_attr * ts_oa; struct seq_tab * ts_next; } * table_seq; #define NULLTABLE_SEQ ((table_seq)0) struct oc_seq { struct _objclass *os_oc; struct oc_seq *os_next; }; #define NULLOCSEQ ((struct oc_seq*) 0) typedef struct _objclass { oid_table oc_ot; struct oc_seq * oc_hierachy; table_seq oc_must; table_seq oc_may; } objectclass; #define NULLOBJECTCLASS ((objectclass * )0) #define objclass_cmp(x,y) ( x == y ? 0 : ( x > y ? -1 : 1 )) oid_table_attr * oid2attr(); oid_table_attr * name2attr(); char * attr2name(); #define attr2name_aux(x) ((x) ? (x)->oa_ot.ot_name : NULLCP) objectclass * oid2oc(); objectclass * name2oc(); char * oc2name(); char * oid2name(); /* find oid wherever it is hiding !!! */ OID name2oid(); char * SkipSpace (); void StripSpace (); #endif
28.712707
85
0.709255
[ "object" ]
1d788cebe27b81c8d672300ad04a101c0a679b0a
1,826
h
C
src/MatrixNonOwned.h
g1257/PsimagLite
1cdeb4530c66cd41bd0c59af9ad2ecb1069ca010
[ "Unlicense" ]
8
2015-08-19T16:06:52.000Z
2021-12-05T02:37:47.000Z
src/MatrixNonOwned.h
npatel37/PsimagLiteORNL
ffa0ffad75c5db218a9edea1a9581fed98c2648f
[ "Unlicense" ]
5
2016-02-02T20:28:21.000Z
2019-07-08T22:56:12.000Z
src/MatrixNonOwned.h
npatel37/PsimagLiteORNL
ffa0ffad75c5db218a9edea1a9581fed98c2648f
[ "Unlicense" ]
5
2016-04-29T17:28:00.000Z
2019-11-22T03:33:19.000Z
#ifndef DMRG_MATRIX_NON_OWNED_H #define DMRG_MATRIX_NON_OWNED_H #include "Matrix.h" namespace PsimagLite { template<typename T> struct VectorConstOrNot { typedef typename Vector<T>::Type Type; }; template<typename T> struct VectorConstOrNot<const T> { typedef const typename Vector<T>::Type Type; }; template<typename T> class MatrixNonOwned { public: MatrixNonOwned(SizeType nrow, SizeType ncol, typename VectorConstOrNot<T>::Type& data, SizeType offset) : nrow_(nrow), ncol_(ncol), data_(&data), offset_(offset) { check(); } explicit MatrixNonOwned(const PsimagLite::Matrix<typename RemoveConst<T>::Type>& m) : nrow_(m.n_row()), ncol_(m.n_col()), data_(&(m.data_)), offset_(0) { check(); } explicit MatrixNonOwned(PsimagLite::Matrix<typename RemoveConst<T>::Type>& m) : nrow_(m.n_row()), ncol_(m.n_col()), data_(&(m.data_)), offset_(0) { check(); } const T& operator()(SizeType i, SizeType j) const { assert(i < nrow_); assert(j < ncol_); assert(offset_ + i + j*nrow_ < data_->size()); return (*data_)[offset_ + i + j*nrow_]; } T& operator()(SizeType i, SizeType j) { assert(i < nrow_); assert(j < ncol_); assert(offset_ + i + j*nrow_ < data_->size()); return (*data_)[offset_ + i + j*nrow_]; } const typename VectorConstOrNot<T>::Type& getVector() const { assert(data_); return *data_; } typename VectorConstOrNot<T>::Type& getVector() { assert(data_); return *data_; } private: void check() const { assert(data_); assert(offset_ + nrow_ - 1 + (ncol_ - 1)*nrow_ < data_->size()); } MatrixNonOwned(const MatrixNonOwned&); MatrixNonOwned& operator=(const MatrixNonOwned&); SizeType nrow_; SizeType ncol_; typename VectorConstOrNot<T>::Type* data_; SizeType offset_; }; } #endif
20.065934
84
0.662651
[ "vector" ]
1d8073919f044c3c4df2325da4fdf92e703b29dc
5,973
h
C
demoinfogo/demofile.h
fuzun/csgo-demoinfo
a0a9aa694e410e34ebf5f87cee6972b01f16df55
[ "BSD-2-Clause" ]
null
null
null
demoinfogo/demofile.h
fuzun/csgo-demoinfo
a0a9aa694e410e34ebf5f87cee6972b01f16df55
[ "BSD-2-Clause" ]
null
null
null
demoinfogo/demofile.h
fuzun/csgo-demoinfo
a0a9aa694e410e34ebf5f87cee6972b01f16df55
[ "BSD-2-Clause" ]
null
null
null
//====== Copyright (c) 2014, Valve 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. // // 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 HOLDER 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 DEMOFILE_H #define DEMOFILE_H #ifdef _WIN32 #pragma once #endif #include <string> #include <crtdefs.h> #define DEMO_HEADER_ID "HL2DEMO" #define DEMO_PROTOCOL 4 #if !defined( MAX_OSPATH ) #define MAX_OSPATH 260 // max length of a filesystem pathname #endif typedef __int32 int32; typedef unsigned __int32 uint32; typedef __int64 int64; typedef unsigned __int64 uint64; typedef unsigned long CRC32_t; // Demo messages enum { // it's a startup message, process as fast as possible dem_signon = 1, // it's a normal network packet that we stored off dem_packet, // sync client clock to demo tick dem_synctick, // console command dem_consolecmd, // user input command dem_usercmd, // network data tables dem_datatables, // end of time. dem_stop, // a blob of binary data understood by a callback function dem_customdata, dem_stringtables, // Last command dem_lastcmd = dem_stringtables }; struct demoheader_t { char demofilestamp[ 8 ]; // Should be HL2DEMO int32 demoprotocol; // Should be DEMO_PROTOCOL int32 networkprotocol; // Should be PROTOCOL_VERSION char servername[ MAX_OSPATH ]; // Name of server char clientname[ MAX_OSPATH ]; // Name of client who recorded the game char mapname[ MAX_OSPATH ]; // Name of map char gamedirectory[ MAX_OSPATH ]; // Name of game directory (com_gamedir) float playback_time; // Time of track int32 playback_ticks; // # of ticks in track int32 playback_frames; // # of frames in track int32 signonlength; // length of sigondata in bytes }; #define FDEMO_NORMAL 0 #define FDEMO_USE_ORIGIN2 ( 1 << 0 ) #define FDEMO_USE_ANGLES2 ( 1 << 1 ) #define FDEMO_NOINTERP ( 1 << 2 ) // don't interpolate between this an last view #define MAX_SPLITSCREEN_CLIENTS 2 struct QAngle { float x, y, z; void Init( void ) { x = y = z = 0.0f; } void Init( float _x, float _y, float _z ) { x = _x; y = _y; z = _z; } }; struct Vector { float x, y, z; void Init( void ) { x = y = z = 0.0f; } void Init( float _x, float _y, float _z ) { x = _x; y = _y; z = _z; } }; struct democmdinfo_t { democmdinfo_t( void ) { } struct Split_t { Split_t( void ) { flags = FDEMO_NORMAL; viewOrigin.Init(); viewAngles.Init(); localViewAngles.Init(); // Resampled origin/angles viewOrigin2.Init(); viewAngles2.Init(); localViewAngles2.Init(); } Split_t( const Split_t& src ) { // Split_t( ); Copy( src ); } Split_t& operator=( const Split_t& src ) { if ( this == &src ) return *this; Copy( src ); return *this; } const Vector& GetViewOrigin( void ) { if ( flags & FDEMO_USE_ORIGIN2 ) { return viewOrigin2; } return viewOrigin; } const QAngle& GetViewAngles( void ) { if ( flags & FDEMO_USE_ANGLES2 ) { return viewAngles2; } return viewAngles; } const QAngle& GetLocalViewAngles( void ) { if ( flags & FDEMO_USE_ANGLES2 ) { return localViewAngles2; } return localViewAngles; } void Reset( void ) { flags = 0; viewOrigin2 = viewOrigin; viewAngles2 = viewAngles; localViewAngles2 = localViewAngles; } int32 flags; // original origin/viewangles Vector viewOrigin; QAngle viewAngles; QAngle localViewAngles; // Resampled origin/viewangles Vector viewOrigin2; QAngle viewAngles2; QAngle localViewAngles2; private: void Copy( const Split_t& src ) { flags = src.flags; viewOrigin = src.viewOrigin; viewAngles = src.viewAngles; localViewAngles = src.localViewAngles; viewOrigin2 = src.viewOrigin2; viewAngles2 = src.viewAngles2; localViewAngles2 = src.localViewAngles2; } }; void Reset( void ) { for ( int i = 0; i < MAX_SPLITSCREEN_CLIENTS; ++i ) { u[ i ].Reset(); } } Split_t u[ MAX_SPLITSCREEN_CLIENTS ]; }; class CDemoFile { void init( void ); public: CDemoFile(); CDemoFile( const char *name ); virtual ~CDemoFile(); bool Open( const char *name ); void Close(); int32 ReadRawData( char *buffer, int32 length ); void ReadSequenceInfo( int32 &nSeqNrIn, int32 &nSeqNrOutAck ); void ReadCmdInfo( democmdinfo_t& info ); void ReadCmdHeader( unsigned char &cmd, int32 &tick, unsigned char& playerSlot ); int32 ReadUserCmd( char *buffer, int32 &size ); demoheader_t *ReadDemoHeader(); demoheader_t m_DemoHeader; //general demo info std::string m_szFileName; size_t m_fileBufferPos; std::string m_fileBuffer; }; #endif // DEMOFILE_H
22.539623
82
0.68592
[ "vector" ]
1d80f3352dca1a639b9ffacd66c136c1aa484d63
4,033
h
C
plugin_III/game_III/meta/meta.CTowerClock.h
gta-chaos-mod/plugin-sdk
e3bf176337774a2afc797a47825f81adde78e899
[ "Zlib" ]
368
2015-01-01T21:42:00.000Z
2022-03-29T06:22:22.000Z
plugin_III/game_III/meta/meta.CTowerClock.h
SteepCheat/plugin-sdk
a17c5d933cb8b06e4959b370092828a6a7aa00ef
[ "Zlib" ]
89
2016-05-08T06:42:36.000Z
2022-03-29T06:49:09.000Z
plugin_III/game_III/meta/meta.CTowerClock.h
SteepCheat/plugin-sdk
a17c5d933cb8b06e4959b370092828a6a7aa00ef
[ "Zlib" ]
179
2015-02-03T23:41:17.000Z
2022-03-26T08:27:16.000Z
/* Plugin-SDK (Grand Theft Auto 3) header file Authors: GTA Community. See more here https://github.com/DK22Pac/plugin-sdk Do not delete this comment block. Respect others' work! */ #include "PluginBase.h" namespace plugin { META_BEGIN(CTowerClock::Init) static int address; static int global_address; static const int id = 0x5000D0; static const bool is_virtual = false; static const int vtable_index = -1; using mv_addresses_t = MvAddresses<0x5000D0, 0x5001B0, 0x500140>; // total references count: 10en (2), 11en (2), steam (2) using refs_t = RefList<0x4FED2E,100,0,0x4FE7C0,1, 0x4FED8C,100,0,0x4FE7C0,2, 0x4FEE0E,110,0,0x4FE8A0,1, 0x4FEE6C,110,0,0x4FE8A0,2, 0x4FED9E,120,0,0x4FE830,1, 0x4FEDFC,120,0,0x4FE830,2>; using def_t = void(CTowerClock *, CVector, float, float, unsigned char, unsigned char, unsigned char, float, float); static const int cb_priority = PRIORITY_BEFORE; using calling_convention_t = CallingConventions::Thiscall; using args_t = ArgPick<ArgTypes<CTowerClock *,CVector,float,float,unsigned char,unsigned char,unsigned char,float,float>, 0,1,2,3,4,5,6,7,8>; META_END META_BEGIN(CTowerClock::Update) static int address; static int global_address; static const int id = 0x500130; static const bool is_virtual = false; static const int vtable_index = -1; using mv_addresses_t = MvAddresses<0x500130, 0x500210, 0x5001A0>; // total references count: 10en (1), 11en (1), steam (1) using refs_t = RefList<0x4FF1BA,100,0,0x4FF0D0,1, 0x4FF29A,110,0,0x4FF1B0,1, 0x4FF22A,120,0,0x4FF140,1>; using def_t = void(CTowerClock *); static const int cb_priority = PRIORITY_BEFORE; using calling_convention_t = CallingConventions::Thiscall; using args_t = ArgPick<ArgTypes<CTowerClock *>, 0>; META_END META_BEGIN(CTowerClock::Render) static int address; static int global_address; static const int id = 0x5001D0; static const bool is_virtual = false; static const int vtable_index = -1; using mv_addresses_t = MvAddresses<0x5001D0, 0x5002B0, 0x500240>; // total references count: 10en (1), 11en (1), steam (1) using refs_t = RefList<0x4FF250,100,0,0x4FF210,1, 0x4FF330,110,0,0x4FF2F0,1, 0x4FF2C0,120,0,0x4FF280,1>; using def_t = void(CTowerClock *); static const int cb_priority = PRIORITY_BEFORE; using calling_convention_t = CallingConventions::Thiscall; using args_t = ArgPick<ArgTypes<CTowerClock *>, 0>; META_END CTOR_META_BEGIN(CTowerClock) static int address; static int global_address; static const int id = 0x500990; static const bool is_virtual = false; static const int vtable_index = -1; using mv_addresses_t = MvAddresses<0x500990, 0x500A70, 0x500A00>; // total references count: 10en (1), 11en (1), steam (1) using refs_t = RefList<0x50094A,100,2,0,1, 0x500A2A,110,2,0,1, 0x5009BA,120,2,0,1>; using def_t = CTowerClock *(CTowerClock *); static const int cb_priority = PRIORITY_BEFORE; using calling_convention_t = CallingConventions::Thiscall; using args_t = ArgPick<ArgTypes<CTowerClock *>, 0>; META_END template<> struct stack_object<CTowerClock> : stack_object_no_default<CTowerClock> { SUPPORTED_10EN_11EN_STEAM stack_object() { plugin::CallMethodDynGlobal<CTowerClock *>(ctor_gaddr(CTowerClock), reinterpret_cast<CTowerClock *>(objBuff)); } }; template <> SUPPORTED_10EN_11EN_STEAM inline CTowerClock *operator_new<CTowerClock>() { void *objData = operator new(sizeof(CTowerClock)); CTowerClock *obj = reinterpret_cast<CTowerClock *>(objData); plugin::CallMethodDynGlobal<CTowerClock *>(ctor_gaddr(CTowerClock), obj); return obj; } template <> SUPPORTED_10EN_11EN_STEAM inline CTowerClock *operator_new_array<CTowerClock>(unsigned int objCount) { void *objData = operator new(sizeof(CTowerClock) * objCount + 4); *reinterpret_cast<unsigned int *>(objData) = objCount; CTowerClock *objArray = reinterpret_cast<CTowerClock *>(reinterpret_cast<unsigned int>(objData) + 4); for (unsigned int i = 0; i < objCount; i++) plugin::CallMethodDynGlobal<CTowerClock *>(ctor_gaddr(CTowerClock), &objArray[i]); return objArray; } }
42.010417
185
0.762212
[ "render" ]
b1e56f1550556b3b27bae0fe3abc0e5e5c9f158a
3,989
h
C
src/SDL2Driver.h
nathanmentley/EssexEngineSDL2Driver
fef618a0134ea731691c61b7e3cf7135cd7d336c
[ "BSD-2-Clause" ]
null
null
null
src/SDL2Driver.h
nathanmentley/EssexEngineSDL2Driver
fef618a0134ea731691c61b7e3cf7135cd7d336c
[ "BSD-2-Clause" ]
null
null
null
src/SDL2Driver.h
nathanmentley/EssexEngineSDL2Driver
fef618a0134ea731691c61b7e3cf7135cd7d336c
[ "BSD-2-Clause" ]
null
null
null
/* * Essex Engine * * Copyright (C) 2018 Nathan Mentley - All Rights Reserved * You may use, distribute and modify this code under the * terms of the BSD license. * * You should have received a copy of the BSD license with * this file. If not, please visit: https://github.com/nathanmentley/EssexEngine */ #pragma once #include <string> #include <map> #include <utility> #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_mixer.h> #include <SDL2/SDL_ttf.h> #include <EssexEngineCore/WeakPointer.h> #include <EssexEngineCore/CachedPointer.h> #include <EssexEngineCore/UniquePointer.h> #include <EssexEngineCore/BaseDriver.h> #include <EssexEngineCore/Context.h> #include <EssexEngineCore/LogDaemon.h> #include <EssexEngineGfxDaemon/IGfxDriver.h> #include <EssexEngineSfxDaemon/ISfxDriver.h> #include <EssexEngineSDL2Driver/SDL2Sprite.h> #include <EssexEngineSDL2Driver/SDL2Font.h> #include <EssexEngineSDL2Driver/SDL2Music.h> #include <EssexEngineSDL2Driver/SDL2Audio.h> namespace EssexEngine{ namespace Drivers{ namespace SDL2{ class SDL2Driver:public Core::Drivers::Base::BaseDriver, public Daemons::Gfx::IGfxDriver, public Daemons::Sfx::ISfxDriver { public: SDL2Driver(WeakPointer<Context> _context); ~SDL2Driver(); //IDriver void Init() { if(GetContext()->HasDaemon<Core::Logging::LogDaemon>()) { GetContext()->GetDaemon<Core::Logging::LogDaemon>()->LogLine( "Loading Driver [%s] [%s]", GetDriverName().c_str(), GetDriverVersion().c_str() ); } } //IGfxDriver void SetupGfx(); void SetupRenderContext(WeakPointer<Daemons::Window::IRenderContext> target); void StartRender(WeakPointer<Daemons::Window::IRenderContext> target); void FinishRender(WeakPointer<Daemons::Window::IRenderContext> target); void RenderEntity(WeakPointer<Daemons::Window::IRenderContext> target, WeakPointer<Daemons::Gfx::Entity> entity); void RenderModel(WeakPointer<Daemons::Window::IRenderContext> target, WeakPointer<Daemons::Gfx::Model> model); void RenderString(WeakPointer<Daemons::Window::IRenderContext> target, WeakPointer<Daemons::Gfx::IFont> font, std::string data, int x, int y); WeakPointer<Daemons::Gfx::IFont> GetFont(WeakPointer<Daemons::Window::IRenderContext> target, CachedPointer<std::string, Daemons::FileSystem::IFileBuffer> fileContent, int fontSize); WeakPointer<Daemons::Gfx::ISprite> GetSprite(WeakPointer<Daemons::Window::IRenderContext> target, CachedPointer<std::string, Daemons::FileSystem::IFileBuffer> fileContent, int _x, int _y, int _width, int _height); //ISfxDriver void SetupSfx(); void PlayAudio(WeakPointer<Daemons::Sfx::IAudio> audio); void PlayMusic(WeakPointer<Daemons::Sfx::IMusic> music); void SetAudioListenerLocation(int _x, int _y, int _z); void UpdateAudioPosition(WeakPointer<Daemons::Sfx::IAudio> audio, int _x, int _y, int _z); WeakPointer<Daemons::Sfx::IAudio> GetAudio(CachedPointer<std::string, Daemons::FileSystem::IFileBuffer> fileContent, int _x, int _y, int _z); WeakPointer<Daemons::Sfx::IMusic> GetMusic(CachedPointer<std::string, Daemons::FileSystem::IFileBuffer> fileContent); //BaseDriver std::string GetDriverName() { return "SDL2"; } std::string GetDriverVersion() { return ESSEX_ENGINE_VERSION; } private: std::map<Daemons::Window::IRenderContext*, WeakPointer<SDL_Surface>> rgbaBuffers; std::map<Daemons::Window::IRenderContext*, WeakPointer<SDL_Surface>> buffers; std::map<Daemons::Window::IRenderContext*, WeakPointer<SDL_Renderer>> renderers; std::map<std::string, WeakPointer<SDL_Texture>> textureCache; int audioX; int audioY; int audioZ; }; }}};
41.123711
221
0.690649
[ "model" ]
b1ebbcad70ee0ebefcbc07ffe45e7d54f63d0664
8,768
h
C
shill/wifi/wifi_provider.h
Toromino/chromiumos-platform2
97e6ba18f0e5ab6723f3448a66f82c1a07538d87
[ "BSD-3-Clause" ]
null
null
null
shill/wifi/wifi_provider.h
Toromino/chromiumos-platform2
97e6ba18f0e5ab6723f3448a66f82c1a07538d87
[ "BSD-3-Clause" ]
null
null
null
shill/wifi/wifi_provider.h
Toromino/chromiumos-platform2
97e6ba18f0e5ab6723f3448a66f82c1a07538d87
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2018 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SHILL_WIFI_WIFI_PROVIDER_H_ #define SHILL_WIFI_WIFI_PROVIDER_H_ #include <map> #include <string> #include <vector> #include "shill/data_types.h" #include "shill/provider_interface.h" #include "shill/refptr_types.h" namespace shill { class ByteString; class Error; class KeyValueStore; class Manager; class Metrics; class WiFiEndpoint; class WiFiService; // The WiFi Provider is the holder of all WiFi Services. It holds both // visible (created due to an Endpoint becoming visible) and invisible // (created due to user or storage configuration) Services. class WiFiProvider : public ProviderInterface { public: // Describes the priority of the network computed during the a match between // a set of Passpoint credentials and a BSS. enum MatchPriority : uint64_t { // Network that belongs to the Passpoint service provider. kHome, // Network that belongs to a partner of the service provider. kRoaming, // Network not identified by supplicant. kUnknown }; // A PasspointMatch represents a match between a set of Passpoint credentials // and an endpoint found during a scan. It helps to identify which service is // connectable based on the contained set of credentials, and what kind of // network it will provide. struct PasspointMatch { PasspointMatch(); PasspointMatch(const PasspointCredentialsRefPtr& cred_in, const WiFiEndpointRefPtr& endp_in, MatchPriority prio_in); // Set of Passpoint credentials that matched. PasspointCredentialsRefPtr credentials; // BSS that matched. WiFiEndpointRefPtr endpoint; // Priority of the network computed during the match. MatchPriority priority; }; explicit WiFiProvider(Manager* manager); WiFiProvider(const WiFiProvider&) = delete; WiFiProvider& operator=(const WiFiProvider&) = delete; ~WiFiProvider() override; // Called by Manager as a part of the Provider interface. The attributes // used for matching services for the WiFi provider are the SSID, mode and // security parameters. void CreateServicesFromProfile(const ProfileRefPtr& profile) override; ServiceRefPtr FindSimilarService(const KeyValueStore& args, Error* error) const override; ServiceRefPtr GetService(const KeyValueStore& args, Error* error) override; ServiceRefPtr CreateTemporaryService(const KeyValueStore& args, Error* error) override; ServiceRefPtr CreateTemporaryServiceFromProfile(const ProfileRefPtr& profile, const std::string& entry_name, Error* error) override; void Start() override; void Stop() override; // Find a Service this Endpoint should be associated with. virtual WiFiServiceRefPtr FindServiceForEndpoint( const WiFiEndpointConstRefPtr& endpoint); // Find or create a Service for |endpoint| to be associated with. This // method first calls FindServiceForEndpoint, and failing this, creates // a new Service. It then associates |endpoint| with this service. // Returns true if |endpoint| is associated to a service that already matched // with passpoint credentials. virtual bool OnEndpointAdded(const WiFiEndpointConstRefPtr& endpoint); // Called by a Device when it removes an Endpoint. If the Provider // forgets a service as a result, it returns a reference to the // forgotten service, otherwise it returns a null reference. virtual WiFiServiceRefPtr OnEndpointRemoved( const WiFiEndpointConstRefPtr& endpoint); // Called by a Device when it receives notification that an Endpoint // has changed. Ensure the updated endpoint still matches its // associated service. If necessary re-assign the endpoint to a new // service, otherwise notify the associated service of the update to // the endpoint. virtual void OnEndpointUpdated(const WiFiEndpointConstRefPtr& endpoint); // Called by a WiFiService when it is unloaded and no longer visible. // |credentials| contains the set of Passpoint credentials of the service, // if any. virtual bool OnServiceUnloaded(const WiFiServiceRefPtr& service, const PasspointCredentialsRefPtr& credentials); // Get the list of SSIDs for hidden WiFi services we are aware of. virtual ByteArrays GetHiddenSSIDList(); // Performs some "provider_of_wifi" storage updates. virtual void UpdateStorage(Profile* profile); // Report the number of auto connectable services available to uma // metrics. void ReportAutoConnectableServices(); // Returns number of services available for auto-connect. virtual int NumAutoConnectableServices(); // Returns a list of ByteStrings representing the SSIDs of WiFi services // configured for auto-connect. std::vector<ByteString> GetSsidsConfiguredForAutoConnect(); // Load to the provider all the Passpoint credentials available in |Profile| // and push the credentials to the WiFi device. void LoadCredentialsFromProfile(const ProfileRefPtr& profile); // Unload from the provider all the Passpoint credentials provided // by |profile| and remove them from the WiFi device. void UnloadCredentialsFromProfile(const ProfileRefPtr& profile); // Adds a new set of credentials to the provider and pushes it to the WiFi // device. virtual void AddCredentials(const PasspointCredentialsRefPtr& credentials); // Removes the set of credentials referenced by |credentials| from the // provider, the WiFi device and invalidates all the services populated with // the set of credentials. virtual bool ForgetCredentials(const PasspointCredentialsRefPtr& credentials); // Removes all credentials that match with |properties| from the provider, // the WiFi device and invalidates all the services populated with the set // of credentials. virtual bool ForgetCredentials(const KeyValueStore& properties); // Get the list of Passpoint credentials known by the provider. virtual std::vector<PasspointCredentialsRefPtr> GetCredentials(); // Get the set of Passpoint credentials referenced by |id|. virtual PasspointCredentialsRefPtr FindCredentials(const std::string& id); // Called by the Wi-Fi device when an interworking selection found // connectable endpoint using Passpoint credentials. virtual void OnPasspointCredentialsMatches( const std::vector<PasspointMatch>& matches); bool disable_vht() const { return disable_vht_; } void set_disable_vht(bool disable_vht) { disable_vht_ = disable_vht; } bool has_passpoint_credentials() const { return !credentials_by_id_.empty(); } private: friend class WiFiProviderTest; using EndpointServiceMap = std::map<const WiFiEndpoint*, WiFiServiceRefPtr>; using PasspointCredentialsMap = std::map<const std::string, PasspointCredentialsRefPtr>; // Add a service to the service_ vector and register it with the Manager. WiFiServiceRefPtr AddService(const std::vector<uint8_t>& ssid, const std::string& mode, const std::string& security_class, bool is_hidden); // Find a service given its properties. // |security| can be either a security class, or a security (security class // is a subset of security). WiFiServiceRefPtr FindService(const std::vector<uint8_t>& ssid, const std::string& mode, const std::string& security) const; // Returns a WiFiServiceRefPtr for unit tests and for down-casting to a // ServiceRefPtr in GetService(). WiFiServiceRefPtr GetWiFiService(const KeyValueStore& args, Error* error); // Disassociate the service from its WiFi device and remove it from the // services_ vector. void ForgetService(const WiFiServiceRefPtr& service); // Removes the set of credentials referenced by |credentials| from both the // provider and the WiFi device. bool RemoveCredentials(const PasspointCredentialsRefPtr& credentials); void ReportRememberedNetworkCount(); void ReportServiceSourceMetrics(); Metrics* metrics() const; // Sort the internal list of services. void SortServices(); Manager* manager_; std::vector<WiFiServiceRefPtr> services_; EndpointServiceMap service_by_endpoint_; PasspointCredentialsMap credentials_by_id_; bool running_; // Disable 802.11ac Very High Throughput (VHT) connections. bool disable_vht_; }; } // namespace shill #endif // SHILL_WIFI_WIFI_PROVIDER_H_
40.03653
80
0.733805
[ "vector" ]
b1edd1d8a63fecf23a223b6fd017de65c9c0841f
11,766
h
C
contrib/epee/include/epee/storages/portable_storage.h
loki-project/loki
946b182384d10362cfe50994b557c7271637949b
[ "BSD-3-Clause" ]
128
2018-03-01T05:40:08.000Z
2020-02-02T17:28:23.000Z
contrib/epee/include/epee/storages/portable_storage.h
loki-project/loki
946b182384d10362cfe50994b557c7271637949b
[ "BSD-3-Clause" ]
377
2018-03-04T22:51:12.000Z
2020-02-05T00:26:29.000Z
contrib/epee/include/epee/storages/portable_storage.h
loki-project/loki
946b182384d10362cfe50994b557c7271637949b
[ "BSD-3-Clause" ]
108
2018-02-15T20:45:58.000Z
2020-01-31T23:19:33.000Z
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net // 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 the Andrey N. Sabelnikov 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 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. // #pragma once #include "portable_storage_base.h" #include "portable_storage_to_bin.h" #include "portable_storage_from_bin.h" #include "portable_storage_to_json.h" #include "portable_storage_from_json.h" #include "portable_storage_val_converters.h" #include "../span.h" namespace epee { namespace serialization { /************************************************************************/ /* */ /************************************************************************/ class portable_storage { public: portable_storage() = default; virtual ~portable_storage() = default; section* open_section(const std::string& section_name, section* parent_section, bool create_if_notexist = false); template <typename T> bool get_value(const std::string& value_name, T& val, section* parent_section); bool get_value(const std::string& value_name, storage_entry& val, section* parent_section); template <class T> bool set_value(const std::string& value_name, const T& target, section* parent_section); // Class for iterating through a type with automatic conversion to `T` when dereferencing. template <typename T> class converting_array_iterator { array_entry& array; size_t index = 0; public: using value_type = T; using difference_type = std::ptrdiff_t; using pointer = T*; using reference = T; using iterator_category = std::input_iterator_tag; explicit converting_array_iterator(array_entry& array) : array{array} {} converting_array_iterator(array_entry& array, bool end) : array{array} { if (end) index = var::visit([](auto& a) { return a.size(); }, array); } // Converting dereference operator. Returns the converted value. Note that this can throw // if the requested conversion fails. T operator*() const { return var::visit([this](auto& a) { T val; convert_t(a[index], val); return val; }, array); } bool operator==(const converting_array_iterator& other) const { return &array == &other.array && index == other.index; } bool operator!=(const converting_array_iterator& other) const { return !(*this == other); } converting_array_iterator operator++(int) { auto old = *this; index++; return old; } converting_array_iterator& operator++() { ++index; return *this; } }; // Returns an input iterator pair for an array with automatic value conversion from the stored // type to T. Throws std::out_of_range if the member doesn't exist or std::bad_variant_access // if the member isn't an array. template <typename T> std::pair<converting_array_iterator<T>, converting_array_iterator<T>> converting_array_range(const std::string& value_name, section* parent_section) { if (!parent_section) parent_section = &m_root; storage_entry* pentry = find_storage_entry(value_name, parent_section); if (!pentry) throw std::out_of_range{value_name + " does not exist"}; auto& ar_entry = var::get<array_entry>(*pentry); return {converting_array_iterator<T>{ar_entry}, converting_array_iterator<T>{ar_entry, true}}; } // Accesses an existing array value of the given type. If the given value does not exist or // is not an array of the given type then this returns nullptr, otherwise returns a pointer to // the array_t<T> (which is a std::vector<T>, or a std::deque<bool>). Note that, unlike // array_range(), this does not convert (so, for example, you can't get uint64_t's if the // stored values are uint32_t's). template <typename T> array_t<T>* get_array(const std::string& value_name, section* parent_section) { if (!parent_section) parent_section = &m_root; if (storage_entry* pentry = find_storage_entry(value_name, parent_section)) if (auto* ar_entry = std::get_if<array_entry>(pentry)) if (auto* array = std::get_if<array_t<T>>(ar_entry)) return array; return nullptr; } /// Inserts a <T> array with the given name inside parent_section. If the element already /// exists it is replaced (if not an array_t<T>) or cleared. Returns a pointer to the /// stored array_entry (which holds an array_t<T>). Returns nullptr on error. template <typename T> array_entry* make_array(const std::string& value_name, section* parent_section); /// Same as above, but returns the array_t<T>* rather than the array_entry. template <typename T> array_t<T>* make_array_t(const std::string& value_name, section* parent_section); //------------------------------------------------------------------------ //delete entry (section, value or array) bool delete_entry(const std::string& pentry_name, section* parent_section = nullptr); //------------------------------------------------------------------------------- bool store_to_binary(std::string& target); bool load_from_binary(const epee::span<const uint8_t> target); bool load_from_binary(std::string_view target) { return load_from_binary(epee::strspan<uint8_t>(target)); } bool dump_as_json(std::string& targetObj, size_t indent = 0, bool insert_newlines = true); bool load_from_json(std::string_view source); /// Lets you store a pointer to some arbitrary context object; typically used to pass some /// context to dependent child objects. template <typename T> void set_context(const T* obj) { context_type = &typeid(T); context = obj; } /// Clears a context pointer stored with set_context void clear_context() { context_type = nullptr; context = nullptr; } /// Retrieves context set by set_context(). Returns nullptr if the stored type doesn't match /// `T`, or if no context pointer is stored at all. template <typename T> const T* get_context() { return (context && context_type && *context_type == typeid(T)) ? static_cast<const T*>(context) : nullptr; } private: section m_root; section* get_root_section() {return &m_root;} storage_entry* find_storage_entry(const std::string& pentry_name, section* psection); template<class entry_type> storage_entry* insert_new_entry_get_storage_entry(const std::string& pentry_name, section* psection, const entry_type& entry); section* insert_new_section(const std::string& pentry_name, section* psection); const void* context = nullptr; const std::type_info* context_type = nullptr; #pragma pack(push) #pragma pack(1) struct storage_block_header { uint32_t m_signature_a; uint32_t m_signature_b; uint8_t m_ver; }; #pragma pack(pop) }; template <typename T> bool portable_storage::get_value(const std::string& value_name, T& val, section* parent_section) { static_assert(variant_contains<T, storage_entry>); //TRY_ENTRY(); if(!parent_section) parent_section = &m_root; storage_entry* pentry = find_storage_entry(value_name, parent_section); if(!pentry) return false; var::visit([&val](const auto& v) { convert_t(v, val); }, *pentry); return true; //CATCH_ENTRY("portable_storage::template<>get_value", false); } //--------------------------------------------------------------------------------------------------------------- template <typename T> bool portable_storage::set_value(const std::string& value_name, const T& v, section* parent_section) { static_assert(variant_contains<T, storage_entry> || std::is_same_v<T, storage_entry>); TRY_ENTRY(); if(!parent_section) parent_section = &m_root; storage_entry* pentry = find_storage_entry(value_name, parent_section); if(!pentry) { pentry = insert_new_entry_get_storage_entry(value_name, parent_section, v); if(!pentry) return false; return true; } *pentry = std::move(v); return true; CATCH_ENTRY("portable_storage::template<>set_value", false); } //--------------------------------------------------------------------------------------------------------------- template<class entry_type> storage_entry* portable_storage::insert_new_entry_get_storage_entry(const std::string& pentry_name, section* psection, const entry_type& entry) { TRY_ENTRY(); CHECK_AND_ASSERT(psection, nullptr); auto ins_res = psection->m_entries.emplace(pentry_name, entry); return &ins_res.first->second; CATCH_ENTRY("portable_storage::insert_new_entry_get_storage_entry", nullptr); } //--------------------------------------------------------------------------------------------------------------- template <typename T> array_entry* portable_storage::make_array(const std::string& value_name, section* parent_section) { TRY_ENTRY(); if(!parent_section) parent_section = &m_root; storage_entry* pentry = find_storage_entry(value_name, parent_section); if(!pentry) { pentry = insert_new_entry_get_storage_entry(value_name, parent_section, array_entry(array_t<T>{})); if (!pentry) return nullptr; } if (!std::holds_alternative<array_entry>(*pentry)) *pentry = array_entry(std::in_place_type<array_t<T>>); auto& arr = var::get<array_entry>(*pentry); if (auto* arr_t = std::get_if<array_t<T>>(&arr)) arr_t->clear(); else arr = array_t<T>{}; return &arr; CATCH_ENTRY("portable_storage::make_array", nullptr); } template <typename T> array_t<T>* portable_storage::make_array_t(const std::string& value_name, section* parent_section) { return std::get_if<array_t<T>>(make_array<T>(value_name, parent_section)); } } }
45.960938
147
0.63692
[ "object", "vector" ]
b1f145d216350d7be902d245542b5a6d0c5ea71b
2,213
c
C
firmware/floppysrc/main.c
thecrazyboy/vector06cc
ba02192cbccaf7fa6763a20c9aa2fd4a1b291023
[ "BSD-2-Clause" ]
21
2015-04-09T21:05:18.000Z
2022-02-02T17:29:46.000Z
firmware/floppysrc/main.c
thecrazyboy/vector06cc
ba02192cbccaf7fa6763a20c9aa2fd4a1b291023
[ "BSD-2-Clause" ]
null
null
null
firmware/floppysrc/main.c
thecrazyboy/vector06cc
ba02192cbccaf7fa6763a20c9aa2fd4a1b291023
[ "BSD-2-Clause" ]
7
2016-05-24T17:47:24.000Z
2022-03-18T14:40:03.000Z
// ==================================================================== // VECTOR-06C FPGA REPLICA // // Copyright (C) 2007-2014, Viacheslav Slavinsky // // This code is distributed under modified BSD license. // For complete licensing information see LICENSE.TXT. // -------------------------------------------------------------------- // // An open implementation of Vector-06C home computer // // Author: Viacheslav Slavinsky, http://sensi.org/~svo // // Source file: main.c // // FDC workhorse main module. // // -------------------------------------------------------------------- #include <string.h> #include "serial.h" #include "specialio.h" #include "integer.h" #include "diskio.h" #include "tff.h" #include "timer.h" #include "config.h" #include "slave.h" #include "osd.h" #include "philes.h" char* cnotice1 = " VECTOR-06C FPGA REPLICA "; char* cnotice2 = "(C)2008-14 VIACHESLAV SLAVINSKY"; /*---------------------------------------------------------*/ /* User Provided Timer Function for FatFs module */ /*---------------------------------------------------------*/ /* This is a real time clock service to be called from */ /* FatFs module. Any valid time must be returned even if */ /* the system does not support a real time clock. */ DWORD get_fattime (void) { return 0; } BYTE* Buffer = (BYTE *)0x0200; void print_result(DRESULT result) { switch (result) { case 0: break; default: ser_puts(" :( "); print_hex((BYTE)result); ser_nl(); break; } } void fill_filename(char *buf, char *fname) { memset(buf, 0, 12); strncpy(buf, fname, 12); } #define CHECKRESULT {/*if (result) break;*/} extern char* ptrfile; void main(void) { BYTE res; DRESULT result; FRESULT fresult; SLAVE_STATUS = 0; GREEN_LEDS = 0xC3; ser_puts("@"); delay2(10); ser_nl(); ser_puts(cnotice1); ser_nl(); ser_puts(cnotice2); thrall(ptrfile, Buffer); print_result(result); ser_puts("\r\nWTF?"); }
23.542553
73
0.488025
[ "vector" ]
b1f5cd3af4d6889573976c705b1819f1979b7449
3,593
h
C
source_for_google/rtf_decomposer/rtf_lib.h
benhedibi/RTF-decomposer
4dc9060dfff3c131a3fc9e5cd0610b1378983c05
[ "Unlicense" ]
1
2020-02-23T14:27:50.000Z
2020-02-23T14:27:50.000Z
source_for_google/rtf_decomposer/rtf_lib.h
benhedibi/RTF-decomposer
4dc9060dfff3c131a3fc9e5cd0610b1378983c05
[ "Unlicense" ]
null
null
null
source_for_google/rtf_decomposer/rtf_lib.h
benhedibi/RTF-decomposer
4dc9060dfff3c131a3fc9e5cd0610b1378983c05
[ "Unlicense" ]
null
null
null
#pragma once #include "global.h" #include "strpos.h" typedef struct { unsigned_int decoded_size; uchar buffer[128]; } t_rtf_decoded_buffer, *p_rtf_decoded_buffer; typedef struct { puchar data; unsigned_int size; unsigned_int flags; } t_rtf_block, *p_rtf_block; typedef struct { puchar data; unsigned_int size; unsigned_int flags; puchar decoded_data; unsigned_int decoded_size; unsigned_int size_left; unsigned_int decoding_flags; t_rtf_decoded_buffer decoded_buffer; } t_rtf_object_data, *p_rtf_object_data; typedef enum { t_rtf_undefined_state, t_rtf_open_brace_state, t_rtf_close_brace_state, t_rtf_execute_control_state, t_rtf_handle_char_state, t_rtf_asterisk_state } t_rtf_state_types; typedef struct { unsigned_int error_code; puchar data; unsigned_int data_size; unsigned_int hdr_flags; p_str_pos strpos_object; puchar max_parsed_address; puchar overlay_data; unsigned_int overlay_size; unsigned_int malformed_document; t_rtf_state_types current_state; t_rtf_state_types last_state; } t_rtf_strm, *p_rtf_strm; boolean open_rtf_strm(const puchar buffer, const unsigned_int buffer_size, const p_rtf_strm strm); void close_rtf_strm(const p_rtf_strm strm); void get_document_overlay(const p_rtf_strm strm); void load_rtf_data(const p_rtf_strm strm); boolean get_first_ole_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_next_ole_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_ole_object_data(const p_rtf_strm strm, const p_rtf_block object, const p_rtf_object_data object_data); boolean get_first_picture_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_next_picture_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_picture_object_data(const p_rtf_strm strm, const p_rtf_block object, const p_rtf_object_data object_data); boolean get_first_font_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_next_font_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_font_object_data(const p_rtf_strm strm, const p_rtf_block object, const p_rtf_object_data object_data); boolean get_first_datafield_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_next_datafield_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_datafield_object_data(const p_rtf_strm strm, const p_rtf_block object, const p_rtf_object_data object_data); boolean get_first_data_storage_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_next_data_storage_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_data_storage_object_data(const p_rtf_strm strm, const p_rtf_block object, const p_rtf_object_data object_data); boolean get_first_shape_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_next_shape_object(const p_rtf_strm strm, const p_rtf_block object); boolean get_shape_object_data(const p_rtf_strm strm, const p_rtf_block object, const p_rtf_object_data object_data); boolean read_object_data(const p_rtf_strm strm, const p_rtf_object_data object_data);
43.817073
124
0.728361
[ "object" ]
b1fa7e9e3b1b2a4462dd72c25ae75907204601e1
66,545
h
C
gen/pb-cpp/flyteidl/admin/project.pb.h
SmritiSatyanV/flyteidl
e8a29e0deb437d9e7086f9e90b72362cd26000a2
[ "Apache-2.0" ]
13
2019-08-05T22:02:36.000Z
2020-07-05T06:21:14.000Z
gen/pb-cpp/flyteidl/admin/project.pb.h
SmritiSatyanV/flyteidl
e8a29e0deb437d9e7086f9e90b72362cd26000a2
[ "Apache-2.0" ]
70
2021-02-01T22:14:27.000Z
2022-03-29T12:56:06.000Z
gen/pb-cpp/flyteidl/admin/project.pb.h
SmritiSatyanV/flyteidl
e8a29e0deb437d9e7086f9e90b72362cd26000a2
[ "Apache-2.0" ]
22
2021-02-01T16:13:28.000Z
2022-02-25T08:15:29.000Z
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: flyteidl/admin/project.proto #ifndef PROTOBUF_INCLUDED_flyteidl_2fadmin_2fproject_2eproto #define PROTOBUF_INCLUDED_flyteidl_2fadmin_2fproject_2eproto #include <limits> #include <string> #include <google/protobuf/port_def.inc> #if PROTOBUF_VERSION < 3007000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif #if 3007000 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/port_undef.inc> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/inlined_string_field.h> #include <google/protobuf/metadata.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> // IWYU pragma: export #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/generated_enum_reflection.h> #include <google/protobuf/unknown_field_set.h> #include "flyteidl/admin/common.pb.h" // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> #define PROTOBUF_INTERNAL_EXPORT_flyteidl_2fadmin_2fproject_2eproto // Internal implementation detail -- do not use these members. struct TableStruct_flyteidl_2fadmin_2fproject_2eproto { static const ::google::protobuf::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::google::protobuf::internal::AuxillaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::google::protobuf::internal::ParseTable schema[7] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; static const ::google::protobuf::uint32 offsets[]; }; void AddDescriptors_flyteidl_2fadmin_2fproject_2eproto(); namespace flyteidl { namespace admin { class Domain; class DomainDefaultTypeInternal; extern DomainDefaultTypeInternal _Domain_default_instance_; class Project; class ProjectDefaultTypeInternal; extern ProjectDefaultTypeInternal _Project_default_instance_; class ProjectListRequest; class ProjectListRequestDefaultTypeInternal; extern ProjectListRequestDefaultTypeInternal _ProjectListRequest_default_instance_; class ProjectRegisterRequest; class ProjectRegisterRequestDefaultTypeInternal; extern ProjectRegisterRequestDefaultTypeInternal _ProjectRegisterRequest_default_instance_; class ProjectRegisterResponse; class ProjectRegisterResponseDefaultTypeInternal; extern ProjectRegisterResponseDefaultTypeInternal _ProjectRegisterResponse_default_instance_; class ProjectUpdateResponse; class ProjectUpdateResponseDefaultTypeInternal; extern ProjectUpdateResponseDefaultTypeInternal _ProjectUpdateResponse_default_instance_; class Projects; class ProjectsDefaultTypeInternal; extern ProjectsDefaultTypeInternal _Projects_default_instance_; } // namespace admin } // namespace flyteidl namespace google { namespace protobuf { template<> ::flyteidl::admin::Domain* Arena::CreateMaybeMessage<::flyteidl::admin::Domain>(Arena*); template<> ::flyteidl::admin::Project* Arena::CreateMaybeMessage<::flyteidl::admin::Project>(Arena*); template<> ::flyteidl::admin::ProjectListRequest* Arena::CreateMaybeMessage<::flyteidl::admin::ProjectListRequest>(Arena*); template<> ::flyteidl::admin::ProjectRegisterRequest* Arena::CreateMaybeMessage<::flyteidl::admin::ProjectRegisterRequest>(Arena*); template<> ::flyteidl::admin::ProjectRegisterResponse* Arena::CreateMaybeMessage<::flyteidl::admin::ProjectRegisterResponse>(Arena*); template<> ::flyteidl::admin::ProjectUpdateResponse* Arena::CreateMaybeMessage<::flyteidl::admin::ProjectUpdateResponse>(Arena*); template<> ::flyteidl::admin::Projects* Arena::CreateMaybeMessage<::flyteidl::admin::Projects>(Arena*); } // namespace protobuf } // namespace google namespace flyteidl { namespace admin { enum Project_ProjectState { Project_ProjectState_ACTIVE = 0, Project_ProjectState_ARCHIVED = 1, Project_ProjectState_SYSTEM_GENERATED = 2, Project_ProjectState_Project_ProjectState_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::google::protobuf::int32>::min(), Project_ProjectState_Project_ProjectState_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::google::protobuf::int32>::max() }; bool Project_ProjectState_IsValid(int value); const Project_ProjectState Project_ProjectState_ProjectState_MIN = Project_ProjectState_ACTIVE; const Project_ProjectState Project_ProjectState_ProjectState_MAX = Project_ProjectState_SYSTEM_GENERATED; const int Project_ProjectState_ProjectState_ARRAYSIZE = Project_ProjectState_ProjectState_MAX + 1; const ::google::protobuf::EnumDescriptor* Project_ProjectState_descriptor(); inline const ::std::string& Project_ProjectState_Name(Project_ProjectState value) { return ::google::protobuf::internal::NameOfEnum( Project_ProjectState_descriptor(), value); } inline bool Project_ProjectState_Parse( const ::std::string& name, Project_ProjectState* value) { return ::google::protobuf::internal::ParseNamedEnum<Project_ProjectState>( Project_ProjectState_descriptor(), name, value); } // =================================================================== class Domain final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.Domain) */ { public: Domain(); virtual ~Domain(); Domain(const Domain& from); inline Domain& operator=(const Domain& from) { CopyFrom(from); return *this; } #if LANG_CXX11 Domain(Domain&& from) noexcept : Domain() { *this = ::std::move(from); } inline Domain& operator=(Domain&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const Domain& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Domain* internal_default_instance() { return reinterpret_cast<const Domain*>( &_Domain_default_instance_); } static constexpr int kIndexInFileMessages = 0; void Swap(Domain* other); friend void swap(Domain& a, Domain& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline Domain* New() const final { return CreateMaybeMessage<Domain>(nullptr); } Domain* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<Domain>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const Domain& from); void MergeFrom(const Domain& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Domain* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // string id = 1; void clear_id(); static const int kIdFieldNumber = 1; const ::std::string& id() const; void set_id(const ::std::string& value); #if LANG_CXX11 void set_id(::std::string&& value); #endif void set_id(const char* value); void set_id(const char* value, size_t size); ::std::string* mutable_id(); ::std::string* release_id(); void set_allocated_id(::std::string* id); // string name = 2; void clear_name(); static const int kNameFieldNumber = 2; const ::std::string& name() const; void set_name(const ::std::string& value); #if LANG_CXX11 void set_name(::std::string&& value); #endif void set_name(const char* value); void set_name(const char* value, size_t size); ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); // @@protoc_insertion_point(class_scope:flyteidl.admin.Domain) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr id_; ::google::protobuf::internal::ArenaStringPtr name_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // ------------------------------------------------------------------- class Project final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.Project) */ { public: Project(); virtual ~Project(); Project(const Project& from); inline Project& operator=(const Project& from) { CopyFrom(from); return *this; } #if LANG_CXX11 Project(Project&& from) noexcept : Project() { *this = ::std::move(from); } inline Project& operator=(Project&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const Project& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Project* internal_default_instance() { return reinterpret_cast<const Project*>( &_Project_default_instance_); } static constexpr int kIndexInFileMessages = 1; void Swap(Project* other); friend void swap(Project& a, Project& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline Project* New() const final { return CreateMaybeMessage<Project>(nullptr); } Project* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<Project>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const Project& from); void MergeFrom(const Project& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Project* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- typedef Project_ProjectState ProjectState; static const ProjectState ACTIVE = Project_ProjectState_ACTIVE; static const ProjectState ARCHIVED = Project_ProjectState_ARCHIVED; static const ProjectState SYSTEM_GENERATED = Project_ProjectState_SYSTEM_GENERATED; static inline bool ProjectState_IsValid(int value) { return Project_ProjectState_IsValid(value); } static const ProjectState ProjectState_MIN = Project_ProjectState_ProjectState_MIN; static const ProjectState ProjectState_MAX = Project_ProjectState_ProjectState_MAX; static const int ProjectState_ARRAYSIZE = Project_ProjectState_ProjectState_ARRAYSIZE; static inline const ::google::protobuf::EnumDescriptor* ProjectState_descriptor() { return Project_ProjectState_descriptor(); } static inline const ::std::string& ProjectState_Name(ProjectState value) { return Project_ProjectState_Name(value); } static inline bool ProjectState_Parse(const ::std::string& name, ProjectState* value) { return Project_ProjectState_Parse(name, value); } // accessors ------------------------------------------------------- // repeated .flyteidl.admin.Domain domains = 3; int domains_size() const; void clear_domains(); static const int kDomainsFieldNumber = 3; ::flyteidl::admin::Domain* mutable_domains(int index); ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Domain >* mutable_domains(); const ::flyteidl::admin::Domain& domains(int index) const; ::flyteidl::admin::Domain* add_domains(); const ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Domain >& domains() const; // string id = 1; void clear_id(); static const int kIdFieldNumber = 1; const ::std::string& id() const; void set_id(const ::std::string& value); #if LANG_CXX11 void set_id(::std::string&& value); #endif void set_id(const char* value); void set_id(const char* value, size_t size); ::std::string* mutable_id(); ::std::string* release_id(); void set_allocated_id(::std::string* id); // string name = 2; void clear_name(); static const int kNameFieldNumber = 2; const ::std::string& name() const; void set_name(const ::std::string& value); #if LANG_CXX11 void set_name(::std::string&& value); #endif void set_name(const char* value); void set_name(const char* value, size_t size); ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); // string description = 4; void clear_description(); static const int kDescriptionFieldNumber = 4; const ::std::string& description() const; void set_description(const ::std::string& value); #if LANG_CXX11 void set_description(::std::string&& value); #endif void set_description(const char* value); void set_description(const char* value, size_t size); ::std::string* mutable_description(); ::std::string* release_description(); void set_allocated_description(::std::string* description); // .flyteidl.admin.Labels labels = 5; bool has_labels() const; void clear_labels(); static const int kLabelsFieldNumber = 5; const ::flyteidl::admin::Labels& labels() const; ::flyteidl::admin::Labels* release_labels(); ::flyteidl::admin::Labels* mutable_labels(); void set_allocated_labels(::flyteidl::admin::Labels* labels); // .flyteidl.admin.Project.ProjectState state = 6; void clear_state(); static const int kStateFieldNumber = 6; ::flyteidl::admin::Project_ProjectState state() const; void set_state(::flyteidl::admin::Project_ProjectState value); // @@protoc_insertion_point(class_scope:flyteidl.admin.Project) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Domain > domains_; ::google::protobuf::internal::ArenaStringPtr id_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr description_; ::flyteidl::admin::Labels* labels_; int state_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // ------------------------------------------------------------------- class Projects final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.Projects) */ { public: Projects(); virtual ~Projects(); Projects(const Projects& from); inline Projects& operator=(const Projects& from) { CopyFrom(from); return *this; } #if LANG_CXX11 Projects(Projects&& from) noexcept : Projects() { *this = ::std::move(from); } inline Projects& operator=(Projects&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const Projects& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Projects* internal_default_instance() { return reinterpret_cast<const Projects*>( &_Projects_default_instance_); } static constexpr int kIndexInFileMessages = 2; void Swap(Projects* other); friend void swap(Projects& a, Projects& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline Projects* New() const final { return CreateMaybeMessage<Projects>(nullptr); } Projects* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<Projects>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const Projects& from); void MergeFrom(const Projects& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Projects* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // repeated .flyteidl.admin.Project projects = 1; int projects_size() const; void clear_projects(); static const int kProjectsFieldNumber = 1; ::flyteidl::admin::Project* mutable_projects(int index); ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Project >* mutable_projects(); const ::flyteidl::admin::Project& projects(int index) const; ::flyteidl::admin::Project* add_projects(); const ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Project >& projects() const; // string token = 2; void clear_token(); static const int kTokenFieldNumber = 2; const ::std::string& token() const; void set_token(const ::std::string& value); #if LANG_CXX11 void set_token(::std::string&& value); #endif void set_token(const char* value); void set_token(const char* value, size_t size); ::std::string* mutable_token(); ::std::string* release_token(); void set_allocated_token(::std::string* token); // @@protoc_insertion_point(class_scope:flyteidl.admin.Projects) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Project > projects_; ::google::protobuf::internal::ArenaStringPtr token_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // ------------------------------------------------------------------- class ProjectListRequest final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.ProjectListRequest) */ { public: ProjectListRequest(); virtual ~ProjectListRequest(); ProjectListRequest(const ProjectListRequest& from); inline ProjectListRequest& operator=(const ProjectListRequest& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProjectListRequest(ProjectListRequest&& from) noexcept : ProjectListRequest() { *this = ::std::move(from); } inline ProjectListRequest& operator=(ProjectListRequest&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const ProjectListRequest& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProjectListRequest* internal_default_instance() { return reinterpret_cast<const ProjectListRequest*>( &_ProjectListRequest_default_instance_); } static constexpr int kIndexInFileMessages = 3; void Swap(ProjectListRequest* other); friend void swap(ProjectListRequest& a, ProjectListRequest& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProjectListRequest* New() const final { return CreateMaybeMessage<ProjectListRequest>(nullptr); } ProjectListRequest* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<ProjectListRequest>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const ProjectListRequest& from); void MergeFrom(const ProjectListRequest& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ProjectListRequest* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // string token = 2; void clear_token(); static const int kTokenFieldNumber = 2; const ::std::string& token() const; void set_token(const ::std::string& value); #if LANG_CXX11 void set_token(::std::string&& value); #endif void set_token(const char* value); void set_token(const char* value, size_t size); ::std::string* mutable_token(); ::std::string* release_token(); void set_allocated_token(::std::string* token); // string filters = 3; void clear_filters(); static const int kFiltersFieldNumber = 3; const ::std::string& filters() const; void set_filters(const ::std::string& value); #if LANG_CXX11 void set_filters(::std::string&& value); #endif void set_filters(const char* value); void set_filters(const char* value, size_t size); ::std::string* mutable_filters(); ::std::string* release_filters(); void set_allocated_filters(::std::string* filters); // .flyteidl.admin.Sort sort_by = 4; bool has_sort_by() const; void clear_sort_by(); static const int kSortByFieldNumber = 4; const ::flyteidl::admin::Sort& sort_by() const; ::flyteidl::admin::Sort* release_sort_by(); ::flyteidl::admin::Sort* mutable_sort_by(); void set_allocated_sort_by(::flyteidl::admin::Sort* sort_by); // uint32 limit = 1; void clear_limit(); static const int kLimitFieldNumber = 1; ::google::protobuf::uint32 limit() const; void set_limit(::google::protobuf::uint32 value); // @@protoc_insertion_point(class_scope:flyteidl.admin.ProjectListRequest) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr token_; ::google::protobuf::internal::ArenaStringPtr filters_; ::flyteidl::admin::Sort* sort_by_; ::google::protobuf::uint32 limit_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // ------------------------------------------------------------------- class ProjectRegisterRequest final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.ProjectRegisterRequest) */ { public: ProjectRegisterRequest(); virtual ~ProjectRegisterRequest(); ProjectRegisterRequest(const ProjectRegisterRequest& from); inline ProjectRegisterRequest& operator=(const ProjectRegisterRequest& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProjectRegisterRequest(ProjectRegisterRequest&& from) noexcept : ProjectRegisterRequest() { *this = ::std::move(from); } inline ProjectRegisterRequest& operator=(ProjectRegisterRequest&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const ProjectRegisterRequest& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProjectRegisterRequest* internal_default_instance() { return reinterpret_cast<const ProjectRegisterRequest*>( &_ProjectRegisterRequest_default_instance_); } static constexpr int kIndexInFileMessages = 4; void Swap(ProjectRegisterRequest* other); friend void swap(ProjectRegisterRequest& a, ProjectRegisterRequest& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProjectRegisterRequest* New() const final { return CreateMaybeMessage<ProjectRegisterRequest>(nullptr); } ProjectRegisterRequest* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<ProjectRegisterRequest>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const ProjectRegisterRequest& from); void MergeFrom(const ProjectRegisterRequest& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ProjectRegisterRequest* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // .flyteidl.admin.Project project = 1; bool has_project() const; void clear_project(); static const int kProjectFieldNumber = 1; const ::flyteidl::admin::Project& project() const; ::flyteidl::admin::Project* release_project(); ::flyteidl::admin::Project* mutable_project(); void set_allocated_project(::flyteidl::admin::Project* project); // @@protoc_insertion_point(class_scope:flyteidl.admin.ProjectRegisterRequest) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::flyteidl::admin::Project* project_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // ------------------------------------------------------------------- class ProjectRegisterResponse final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.ProjectRegisterResponse) */ { public: ProjectRegisterResponse(); virtual ~ProjectRegisterResponse(); ProjectRegisterResponse(const ProjectRegisterResponse& from); inline ProjectRegisterResponse& operator=(const ProjectRegisterResponse& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProjectRegisterResponse(ProjectRegisterResponse&& from) noexcept : ProjectRegisterResponse() { *this = ::std::move(from); } inline ProjectRegisterResponse& operator=(ProjectRegisterResponse&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const ProjectRegisterResponse& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProjectRegisterResponse* internal_default_instance() { return reinterpret_cast<const ProjectRegisterResponse*>( &_ProjectRegisterResponse_default_instance_); } static constexpr int kIndexInFileMessages = 5; void Swap(ProjectRegisterResponse* other); friend void swap(ProjectRegisterResponse& a, ProjectRegisterResponse& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProjectRegisterResponse* New() const final { return CreateMaybeMessage<ProjectRegisterResponse>(nullptr); } ProjectRegisterResponse* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<ProjectRegisterResponse>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const ProjectRegisterResponse& from); void MergeFrom(const ProjectRegisterResponse& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ProjectRegisterResponse* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // @@protoc_insertion_point(class_scope:flyteidl.admin.ProjectRegisterResponse) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // ------------------------------------------------------------------- class ProjectUpdateResponse final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:flyteidl.admin.ProjectUpdateResponse) */ { public: ProjectUpdateResponse(); virtual ~ProjectUpdateResponse(); ProjectUpdateResponse(const ProjectUpdateResponse& from); inline ProjectUpdateResponse& operator=(const ProjectUpdateResponse& from) { CopyFrom(from); return *this; } #if LANG_CXX11 ProjectUpdateResponse(ProjectUpdateResponse&& from) noexcept : ProjectUpdateResponse() { *this = ::std::move(from); } inline ProjectUpdateResponse& operator=(ProjectUpdateResponse&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor() { return default_instance().GetDescriptor(); } static const ProjectUpdateResponse& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ProjectUpdateResponse* internal_default_instance() { return reinterpret_cast<const ProjectUpdateResponse*>( &_ProjectUpdateResponse_default_instance_); } static constexpr int kIndexInFileMessages = 6; void Swap(ProjectUpdateResponse* other); friend void swap(ProjectUpdateResponse& a, ProjectUpdateResponse& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline ProjectUpdateResponse* New() const final { return CreateMaybeMessage<ProjectUpdateResponse>(nullptr); } ProjectUpdateResponse* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<ProjectUpdateResponse>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const ProjectUpdateResponse& from); void MergeFrom(const ProjectUpdateResponse& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } #else bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ProjectUpdateResponse* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { return nullptr; } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // @@protoc_insertion_point(class_scope:flyteidl.admin.ProjectUpdateResponse) private: class HasBitSetters; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fadmin_2fproject_2eproto; }; // =================================================================== // =================================================================== #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ // Domain // string id = 1; inline void Domain::clear_id() { id_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Domain::id() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Domain.id) return id_.GetNoArena(); } inline void Domain::set_id(const ::std::string& value) { id_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.Domain.id) } #if LANG_CXX11 inline void Domain::set_id(::std::string&& value) { id_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.Domain.id) } #endif inline void Domain::set_id(const char* value) { GOOGLE_DCHECK(value != nullptr); id_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.Domain.id) } inline void Domain::set_id(const char* value, size_t size) { id_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.Domain.id) } inline ::std::string* Domain::mutable_id() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Domain.id) return id_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Domain::release_id() { // @@protoc_insertion_point(field_release:flyteidl.admin.Domain.id) return id_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Domain::set_allocated_id(::std::string* id) { if (id != nullptr) { } else { } id_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), id); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Domain.id) } // string name = 2; inline void Domain::clear_name() { name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Domain::name() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Domain.name) return name_.GetNoArena(); } inline void Domain::set_name(const ::std::string& value) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.Domain.name) } #if LANG_CXX11 inline void Domain::set_name(::std::string&& value) { name_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.Domain.name) } #endif inline void Domain::set_name(const char* value) { GOOGLE_DCHECK(value != nullptr); name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.Domain.name) } inline void Domain::set_name(const char* value, size_t size) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.Domain.name) } inline ::std::string* Domain::mutable_name() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Domain.name) return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Domain::release_name() { // @@protoc_insertion_point(field_release:flyteidl.admin.Domain.name) return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Domain::set_allocated_name(::std::string* name) { if (name != nullptr) { } else { } name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Domain.name) } // ------------------------------------------------------------------- // Project // string id = 1; inline void Project::clear_id() { id_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Project::id() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Project.id) return id_.GetNoArena(); } inline void Project::set_id(const ::std::string& value) { id_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.Project.id) } #if LANG_CXX11 inline void Project::set_id(::std::string&& value) { id_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.Project.id) } #endif inline void Project::set_id(const char* value) { GOOGLE_DCHECK(value != nullptr); id_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.Project.id) } inline void Project::set_id(const char* value, size_t size) { id_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.Project.id) } inline ::std::string* Project::mutable_id() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Project.id) return id_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Project::release_id() { // @@protoc_insertion_point(field_release:flyteidl.admin.Project.id) return id_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Project::set_allocated_id(::std::string* id) { if (id != nullptr) { } else { } id_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), id); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Project.id) } // string name = 2; inline void Project::clear_name() { name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Project::name() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Project.name) return name_.GetNoArena(); } inline void Project::set_name(const ::std::string& value) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.Project.name) } #if LANG_CXX11 inline void Project::set_name(::std::string&& value) { name_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.Project.name) } #endif inline void Project::set_name(const char* value) { GOOGLE_DCHECK(value != nullptr); name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.Project.name) } inline void Project::set_name(const char* value, size_t size) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.Project.name) } inline ::std::string* Project::mutable_name() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Project.name) return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Project::release_name() { // @@protoc_insertion_point(field_release:flyteidl.admin.Project.name) return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Project::set_allocated_name(::std::string* name) { if (name != nullptr) { } else { } name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Project.name) } // repeated .flyteidl.admin.Domain domains = 3; inline int Project::domains_size() const { return domains_.size(); } inline void Project::clear_domains() { domains_.Clear(); } inline ::flyteidl::admin::Domain* Project::mutable_domains(int index) { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Project.domains) return domains_.Mutable(index); } inline ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Domain >* Project::mutable_domains() { // @@protoc_insertion_point(field_mutable_list:flyteidl.admin.Project.domains) return &domains_; } inline const ::flyteidl::admin::Domain& Project::domains(int index) const { // @@protoc_insertion_point(field_get:flyteidl.admin.Project.domains) return domains_.Get(index); } inline ::flyteidl::admin::Domain* Project::add_domains() { // @@protoc_insertion_point(field_add:flyteidl.admin.Project.domains) return domains_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Domain >& Project::domains() const { // @@protoc_insertion_point(field_list:flyteidl.admin.Project.domains) return domains_; } // string description = 4; inline void Project::clear_description() { description_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Project::description() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Project.description) return description_.GetNoArena(); } inline void Project::set_description(const ::std::string& value) { description_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.Project.description) } #if LANG_CXX11 inline void Project::set_description(::std::string&& value) { description_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.Project.description) } #endif inline void Project::set_description(const char* value) { GOOGLE_DCHECK(value != nullptr); description_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.Project.description) } inline void Project::set_description(const char* value, size_t size) { description_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.Project.description) } inline ::std::string* Project::mutable_description() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Project.description) return description_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Project::release_description() { // @@protoc_insertion_point(field_release:flyteidl.admin.Project.description) return description_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Project::set_allocated_description(::std::string* description) { if (description != nullptr) { } else { } description_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), description); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Project.description) } // .flyteidl.admin.Labels labels = 5; inline bool Project::has_labels() const { return this != internal_default_instance() && labels_ != nullptr; } inline const ::flyteidl::admin::Labels& Project::labels() const { const ::flyteidl::admin::Labels* p = labels_; // @@protoc_insertion_point(field_get:flyteidl.admin.Project.labels) return p != nullptr ? *p : *reinterpret_cast<const ::flyteidl::admin::Labels*>( &::flyteidl::admin::_Labels_default_instance_); } inline ::flyteidl::admin::Labels* Project::release_labels() { // @@protoc_insertion_point(field_release:flyteidl.admin.Project.labels) ::flyteidl::admin::Labels* temp = labels_; labels_ = nullptr; return temp; } inline ::flyteidl::admin::Labels* Project::mutable_labels() { if (labels_ == nullptr) { auto* p = CreateMaybeMessage<::flyteidl::admin::Labels>(GetArenaNoVirtual()); labels_ = p; } // @@protoc_insertion_point(field_mutable:flyteidl.admin.Project.labels) return labels_; } inline void Project::set_allocated_labels(::flyteidl::admin::Labels* labels) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(labels_); } if (labels) { ::google::protobuf::Arena* submessage_arena = nullptr; if (message_arena != submessage_arena) { labels = ::google::protobuf::internal::GetOwnedMessage( message_arena, labels, submessage_arena); } } else { } labels_ = labels; // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Project.labels) } // .flyteidl.admin.Project.ProjectState state = 6; inline void Project::clear_state() { state_ = 0; } inline ::flyteidl::admin::Project_ProjectState Project::state() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Project.state) return static_cast< ::flyteidl::admin::Project_ProjectState >(state_); } inline void Project::set_state(::flyteidl::admin::Project_ProjectState value) { state_ = value; // @@protoc_insertion_point(field_set:flyteidl.admin.Project.state) } // ------------------------------------------------------------------- // Projects // repeated .flyteidl.admin.Project projects = 1; inline int Projects::projects_size() const { return projects_.size(); } inline void Projects::clear_projects() { projects_.Clear(); } inline ::flyteidl::admin::Project* Projects::mutable_projects(int index) { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Projects.projects) return projects_.Mutable(index); } inline ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Project >* Projects::mutable_projects() { // @@protoc_insertion_point(field_mutable_list:flyteidl.admin.Projects.projects) return &projects_; } inline const ::flyteidl::admin::Project& Projects::projects(int index) const { // @@protoc_insertion_point(field_get:flyteidl.admin.Projects.projects) return projects_.Get(index); } inline ::flyteidl::admin::Project* Projects::add_projects() { // @@protoc_insertion_point(field_add:flyteidl.admin.Projects.projects) return projects_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::flyteidl::admin::Project >& Projects::projects() const { // @@protoc_insertion_point(field_list:flyteidl.admin.Projects.projects) return projects_; } // string token = 2; inline void Projects::clear_token() { token_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Projects::token() const { // @@protoc_insertion_point(field_get:flyteidl.admin.Projects.token) return token_.GetNoArena(); } inline void Projects::set_token(const ::std::string& value) { token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.Projects.token) } #if LANG_CXX11 inline void Projects::set_token(::std::string&& value) { token_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.Projects.token) } #endif inline void Projects::set_token(const char* value) { GOOGLE_DCHECK(value != nullptr); token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.Projects.token) } inline void Projects::set_token(const char* value, size_t size) { token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.Projects.token) } inline ::std::string* Projects::mutable_token() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.Projects.token) return token_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Projects::release_token() { // @@protoc_insertion_point(field_release:flyteidl.admin.Projects.token) return token_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Projects::set_allocated_token(::std::string* token) { if (token != nullptr) { } else { } token_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), token); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.Projects.token) } // ------------------------------------------------------------------- // ProjectListRequest // uint32 limit = 1; inline void ProjectListRequest::clear_limit() { limit_ = 0u; } inline ::google::protobuf::uint32 ProjectListRequest::limit() const { // @@protoc_insertion_point(field_get:flyteidl.admin.ProjectListRequest.limit) return limit_; } inline void ProjectListRequest::set_limit(::google::protobuf::uint32 value) { limit_ = value; // @@protoc_insertion_point(field_set:flyteidl.admin.ProjectListRequest.limit) } // string token = 2; inline void ProjectListRequest::clear_token() { token_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& ProjectListRequest::token() const { // @@protoc_insertion_point(field_get:flyteidl.admin.ProjectListRequest.token) return token_.GetNoArena(); } inline void ProjectListRequest::set_token(const ::std::string& value) { token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.ProjectListRequest.token) } #if LANG_CXX11 inline void ProjectListRequest::set_token(::std::string&& value) { token_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.ProjectListRequest.token) } #endif inline void ProjectListRequest::set_token(const char* value) { GOOGLE_DCHECK(value != nullptr); token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.ProjectListRequest.token) } inline void ProjectListRequest::set_token(const char* value, size_t size) { token_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.ProjectListRequest.token) } inline ::std::string* ProjectListRequest::mutable_token() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.ProjectListRequest.token) return token_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ProjectListRequest::release_token() { // @@protoc_insertion_point(field_release:flyteidl.admin.ProjectListRequest.token) return token_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ProjectListRequest::set_allocated_token(::std::string* token) { if (token != nullptr) { } else { } token_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), token); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.ProjectListRequest.token) } // string filters = 3; inline void ProjectListRequest::clear_filters() { filters_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& ProjectListRequest::filters() const { // @@protoc_insertion_point(field_get:flyteidl.admin.ProjectListRequest.filters) return filters_.GetNoArena(); } inline void ProjectListRequest::set_filters(const ::std::string& value) { filters_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:flyteidl.admin.ProjectListRequest.filters) } #if LANG_CXX11 inline void ProjectListRequest::set_filters(::std::string&& value) { filters_.SetNoArena( &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); // @@protoc_insertion_point(field_set_rvalue:flyteidl.admin.ProjectListRequest.filters) } #endif inline void ProjectListRequest::set_filters(const char* value) { GOOGLE_DCHECK(value != nullptr); filters_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:flyteidl.admin.ProjectListRequest.filters) } inline void ProjectListRequest::set_filters(const char* value, size_t size) { filters_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:flyteidl.admin.ProjectListRequest.filters) } inline ::std::string* ProjectListRequest::mutable_filters() { // @@protoc_insertion_point(field_mutable:flyteidl.admin.ProjectListRequest.filters) return filters_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ProjectListRequest::release_filters() { // @@protoc_insertion_point(field_release:flyteidl.admin.ProjectListRequest.filters) return filters_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ProjectListRequest::set_allocated_filters(::std::string* filters) { if (filters != nullptr) { } else { } filters_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), filters); // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.ProjectListRequest.filters) } // .flyteidl.admin.Sort sort_by = 4; inline bool ProjectListRequest::has_sort_by() const { return this != internal_default_instance() && sort_by_ != nullptr; } inline const ::flyteidl::admin::Sort& ProjectListRequest::sort_by() const { const ::flyteidl::admin::Sort* p = sort_by_; // @@protoc_insertion_point(field_get:flyteidl.admin.ProjectListRequest.sort_by) return p != nullptr ? *p : *reinterpret_cast<const ::flyteidl::admin::Sort*>( &::flyteidl::admin::_Sort_default_instance_); } inline ::flyteidl::admin::Sort* ProjectListRequest::release_sort_by() { // @@protoc_insertion_point(field_release:flyteidl.admin.ProjectListRequest.sort_by) ::flyteidl::admin::Sort* temp = sort_by_; sort_by_ = nullptr; return temp; } inline ::flyteidl::admin::Sort* ProjectListRequest::mutable_sort_by() { if (sort_by_ == nullptr) { auto* p = CreateMaybeMessage<::flyteidl::admin::Sort>(GetArenaNoVirtual()); sort_by_ = p; } // @@protoc_insertion_point(field_mutable:flyteidl.admin.ProjectListRequest.sort_by) return sort_by_; } inline void ProjectListRequest::set_allocated_sort_by(::flyteidl::admin::Sort* sort_by) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(sort_by_); } if (sort_by) { ::google::protobuf::Arena* submessage_arena = nullptr; if (message_arena != submessage_arena) { sort_by = ::google::protobuf::internal::GetOwnedMessage( message_arena, sort_by, submessage_arena); } } else { } sort_by_ = sort_by; // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.ProjectListRequest.sort_by) } // ------------------------------------------------------------------- // ProjectRegisterRequest // .flyteidl.admin.Project project = 1; inline bool ProjectRegisterRequest::has_project() const { return this != internal_default_instance() && project_ != nullptr; } inline void ProjectRegisterRequest::clear_project() { if (GetArenaNoVirtual() == nullptr && project_ != nullptr) { delete project_; } project_ = nullptr; } inline const ::flyteidl::admin::Project& ProjectRegisterRequest::project() const { const ::flyteidl::admin::Project* p = project_; // @@protoc_insertion_point(field_get:flyteidl.admin.ProjectRegisterRequest.project) return p != nullptr ? *p : *reinterpret_cast<const ::flyteidl::admin::Project*>( &::flyteidl::admin::_Project_default_instance_); } inline ::flyteidl::admin::Project* ProjectRegisterRequest::release_project() { // @@protoc_insertion_point(field_release:flyteidl.admin.ProjectRegisterRequest.project) ::flyteidl::admin::Project* temp = project_; project_ = nullptr; return temp; } inline ::flyteidl::admin::Project* ProjectRegisterRequest::mutable_project() { if (project_ == nullptr) { auto* p = CreateMaybeMessage<::flyteidl::admin::Project>(GetArenaNoVirtual()); project_ = p; } // @@protoc_insertion_point(field_mutable:flyteidl.admin.ProjectRegisterRequest.project) return project_; } inline void ProjectRegisterRequest::set_allocated_project(::flyteidl::admin::Project* project) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { delete project_; } if (project) { ::google::protobuf::Arena* submessage_arena = nullptr; if (message_arena != submessage_arena) { project = ::google::protobuf::internal::GetOwnedMessage( message_arena, project, submessage_arena); } } else { } project_ = project; // @@protoc_insertion_point(field_set_allocated:flyteidl.admin.ProjectRegisterRequest.project) } // ------------------------------------------------------------------- // ProjectRegisterResponse // ------------------------------------------------------------------- // ProjectUpdateResponse #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) } // namespace admin } // namespace flyteidl namespace google { namespace protobuf { template <> struct is_proto_enum< ::flyteidl::admin::Project_ProjectState> : ::std::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::flyteidl::admin::Project_ProjectState>() { return ::flyteidl::admin::Project_ProjectState_descriptor(); } } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc> #endif // PROTOBUF_INCLUDED_flyteidl_2fadmin_2fproject_2eproto
37.134487
135
0.715501
[ "object" ]
b1fd0a1d5115d6f578125508c5032157461c3aed
1,177
h
C
Samples/CaseStudies/Reduction/IReduce.h
AdeMiller/CppAmp
2f2c222ec796968dcdc43ea1d84c825169693331
[ "MS-PL" ]
null
null
null
Samples/CaseStudies/Reduction/IReduce.h
AdeMiller/CppAmp
2f2c222ec796968dcdc43ea1d84c825169693331
[ "MS-PL" ]
null
null
null
Samples/CaseStudies/Reduction/IReduce.h
AdeMiller/CppAmp
2f2c222ec796968dcdc43ea1d84c825169693331
[ "MS-PL" ]
null
null
null
//=============================================================================== // // Microsoft Press // C++ AMP: Accelerated Massive Parallelism with Microsoft Visual C++ // //=============================================================================== // Copyright (c) 2012-2013 Ade Miller & Kate Gregory. All rights reserved. // This code released under the terms of the // Microsoft Public License (Ms-PL), http://ampbook.codeplex.com/license. // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. //=============================================================================== //---------------------------------------------------------------------------- // Interface implemented by all reduction implementations. //---------------------------------------------------------------------------- #pragma once class IReduce { public: virtual int Reduce(accelerator_view& view, const std::vector<int>& source, double& computeTime) const = 0; };
40.586207
82
0.46559
[ "vector" ]
590b689d616ced91bb4d1ac4e71a155366b4a364
442
h
C
include/tssx/free-list.h
d4tocchini/tssx
fc7ad0a6f916375822a3e5c5ada32df2a4132a51
[ "MIT" ]
55
2016-12-02T09:15:11.000Z
2022-02-06T20:44:42.000Z
include/tssx/free-list.h
MJChku/tssx
ea0fc583c6bcffc83b55f1320743ac511b2e709c
[ "MIT" ]
2
2016-08-09T19:20:15.000Z
2017-01-11T11:56:01.000Z
include/tssx/free-list.h
MJChku/tssx
ea0fc583c6bcffc83b55f1320743ac511b2e709c
[ "MIT" ]
10
2018-06-13T16:36:34.000Z
2021-12-07T04:30:37.000Z
#ifndef FREE_LIST_H #define FREE_LIST_H #include <stdbool.h> #include <stddef.h> #include "tssx/definitions.h" #define FREE_LIST_INITIALIZER VECTOR_INITIALIZER struct Vector; typedef struct Vector FreeList; void free_list_setup(FreeList* list); void free_list_destroy(FreeList* list); void free_list_push(FreeList* list, key_t key); int free_list_pop(FreeList* list); bool free_list_is_empty(FreeList* list); #endif /* FREE_LIST_H */
19.217391
48
0.791855
[ "vector" ]
5912a196775eaebe4984341fc82bb45d8fea466e
9,094
h
C
trunk/3rdparty/srt-1-fit/srtcore/fec.h
attenuation/srs
897d2104fb79c4fc1a89e3889645424c077535bd
[ "MIT" ]
18,396
2015-11-11T09:36:37.000Z
2022-03-31T23:31:51.000Z
trunk/3rdparty/srt-1-fit/srtcore/fec.h
attenuation/srs
897d2104fb79c4fc1a89e3889645424c077535bd
[ "MIT" ]
2,471
2015-11-10T04:01:38.000Z
2022-03-31T21:37:21.000Z
trunk/3rdparty/srt-1-fit/srtcore/fec.h
attenuation/srs
897d2104fb79c4fc1a89e3889645424c077535bd
[ "MIT" ]
4,219
2015-11-10T12:17:34.000Z
2022-03-31T10:41:43.000Z
/* * SRT - Secure, Reliable, Transport * Copyright (c) 2019 Haivision Systems Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef INC__SRT_FEC_H #define INC__SRT_FEC_H #include <string> #include <map> #include <vector> #include <deque> #include "packetfilter_api.h" class FECFilterBuiltin: public SrtPacketFilterBase { SrtFilterConfig cfg; size_t m_number_cols; size_t m_number_rows; // Configuration SRT_ARQLevel m_fallback_level; bool m_cols_only; bool m_arrangement_staircase; public: size_t numberCols() const { return m_number_cols; } size_t numberRows() const { return m_number_rows; } size_t sizeCol() const { return m_number_rows; } size_t sizeRow() const { return m_number_cols; } struct Group { int32_t base; //< Sequence of the first packet in the group size_t step; //< by how many packets the sequence should increase to get the next packet size_t drop; //< by how much the sequence should increase to get to the next series size_t collected; //< how many packets were taken to collect the clip Group(): base(CSeqNo::m_iMaxSeqNo), step(0), drop(0), collected(0) { } uint16_t length_clip; uint8_t flag_clip; uint32_t timestamp_clip; std::vector<char> payload_clip; // This is mutable because it's an intermediate buffer for // the purpose of output. //mutable vector<char> output_buffer; enum Type { HORIZ, // Horizontal, recursive VERT, // Vertical, recursive // NOTE: HORIZ/VERT are defined as 0/1 so that not-inversion // can flip between them. SINGLE // Horizontal-only with no recursion }; }; struct RcvGroup: Group { bool fec; bool dismissed; RcvGroup(): fec(false), dismissed(false) {} #if ENABLE_HEAVY_LOGGING std::string DisplayStats() { if (base == CSeqNo::m_iMaxSeqNo) return "UNINITIALIZED!!!"; std::ostringstream os; os << "base=" << base << " step=" << step << " drop=" << drop << " collected=" << collected << " " << (fec ? "+" : "-") << "FEC " << (dismissed ? "DISMISSED" : "active"); return os.str(); } #endif }; private: // Row Groups: every item represents a single row group and collects clips for one row. // Col Groups: every item represents a signel column group and collect clips for packets represented in one column struct Send { // We need only ONE horizontal group. Simply after the group // is closed (last packet supplied), and the FEC packet extracted, // the group is no longer in use. Group row; std::vector<Group> cols; } snd; struct Receive { SRTSOCKET id; bool order_required; Receive(std::vector<SrtPacket>& provided): id(SRT_INVALID_SOCK), order_required(false), rebuilt(provided) { } // In reception we need to keep as many horizontal groups as required // for possible later tracking. A horizontal group should be dismissed // when the size of this container exceeds the `m_number_rows` (size of the column). // // The 'std::deque' type is used here for a trial implementation. A desired solution // would be a kind of a ring buffer where new groups are added and old (exceeding // the size) automatically dismissed. std::deque<RcvGroup> rowq; // Base index at the oldest column platform determines // the base index of the queue. Meaning, first you need // to determnine the column index, where the index 0 is // the fistmost element of this queue. After determining // the column index, there must be also a second factor // deteremined - which column series it is. So, this can // start by extracting the base sequence of the element // at the index column. This is the series 0. Now, the // distance between these two sequences, divided by // rowsize*colsize should return %index-in-column, // /number-series. The latter multiplied by the row size // is the offset between the firstmost column and the // searched column. std::deque<RcvGroup> colq; // This keeps the value of "packet received or not". // The sequence number of the first cell is rowq[0].base. // When dropping a row, // - the firstmost element of rowq is removed // - the length of one row is removed from this std::vector int32_t cell_base; std::deque<bool> cells; // Note this function will automatically extend the container // with empty cells if the index exceeds the size, HOWEVER // the caller must make sure that this index isn't any "crazy", // that is, it fits somehow in reasonable ranges. bool CellAt(size_t index) { if (index >= cells.size()) { // Cells not prepared for this sequence yet, // so extend in advance. cells.resize(index+1, false); return false; // It wasn't marked, anyway. } return cells[index]; } typedef SrtPacket PrivPacket; std::vector<PrivPacket>& rebuilt; } rcv; void ConfigureGroup(Group& g, int32_t seqno, size_t gstep, size_t drop); template <class Container> void ConfigureColumns(Container& which, int32_t isn); void ResetGroup(Group& g); // Universal void ClipData(Group& g, uint16_t length_net, uint8_t kflg, uint32_t timestamp_hw, const char* payload, size_t payload_size); void ClipPacket(Group& g, const CPacket& pkt); // Sending bool CheckGroupClose(Group& g, size_t pos, size_t size); void PackControl(const Group& g, signed char groupix, SrtPacket& pkt, int32_t seqno); // Receiving void CheckLargeDrop(int32_t seqno); int ExtendRows(int rowx); int ExtendColumns(int colgx); void MarkCellReceived(int32_t seq); bool HangHorizontal(const CPacket& pkt, bool fec_ctl, loss_seqs_t& irrecover); bool HangVertical(const CPacket& pkt, signed char fec_colx, loss_seqs_t& irrecover); void ClipControlPacket(Group& g, const CPacket& pkt); void ClipRebuiltPacket(Group& g, Receive::PrivPacket& pkt); void RcvRebuild(Group& g, int32_t seqno, Group::Type tp); int32_t RcvGetLossSeqHoriz(Group& g); int32_t RcvGetLossSeqVert(Group& g); static void TranslateLossRecords(const std::set<int32_t>& loss, loss_seqs_t& irrecover); void RcvCheckDismissColumn(int32_t seqno, int colgx, loss_seqs_t& irrecover); int RcvGetRowGroupIndex(int32_t seq); int RcvGetColumnGroupIndex(int32_t seq); void CollectIrrecoverRow(RcvGroup& g, loss_seqs_t& irrecover) const; bool IsLost(int32_t seq) const; public: FECFilterBuiltin(const SrtFilterInitializer& init, std::vector<SrtPacket>& provided, const std::string& confstr); // Sender side // This function creates and stores the FEC control packet with // a prediction to be immediately sent. This is called in the function // that normally is prepared for extracting a data packet from the sender // buffer and send it over the channel. virtual bool packControlPacket(SrtPacket& r_packet, int32_t seq) ATR_OVERRIDE; // This is called at the moment when the sender queue decided to pick up // a new packet from the scheduled packets. This should be then used to // continue filling the group, possibly followed by final calculating the // FEC control packet ready to send. virtual void feedSource(CPacket& r_packet) ATR_OVERRIDE; // Receiver side // This function is called at the moment when a new data packet has // arrived (no matter if subsequent or recovered). The 'state' value // defines the configured level of loss state required to send the // loss report. virtual bool receive(const CPacket& pkt, loss_seqs_t& loss_seqs) ATR_OVERRIDE; // Configuration // This is the size that is needed extra by packets operated by this corrector. // It should be subtracted from a current maximum value for SRTO_PAYLOADSIZE // The default FEC uses extra space only for FEC/CTL packet. // The timestamp clip is placed in the timestamp field in the header. // The payload contains: // - the length clip // - the flag spec // - the payload clip // The payload clip takes simply the current length of SRTO_PAYLOADSIZE. // So extra 4 bytes are needed, 2 for flags, 2 for length clip. static const size_t EXTRA_SIZE = 4; virtual SRT_ARQLevel arqLevel() ATR_OVERRIDE { return m_fallback_level; } }; #endif
36.522088
118
0.655047
[ "vector" ]